Run As Administrator

Discuss any general programming issues here
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Run As Administrator

Post by xabierpayet »

can i get an example to use the run instruction with runas in an app in administrator mode?
i don't see how call it correctly

Verb:
On Windows, this can be set to a string telling Run() what to do with the file. This can be one of the following verbs:

runas
Launches the specified file in administrator mode.
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Run As Administrator

Post by Flinx »

Example: Open Services control to look for the state, stop Windows Update, Wait, start Windows Update

Code: Select all

Run("C:\\Windows\\System32\\services.msc")
Run("C:\\Windows\\System32\\net.exe","stop wuauserv",{Verb="runas"})
NPrint("Now press refresh button in Services window")
Wait(30,#SECONDS)
Run("C:\\Windows\\System32\\net.exe","start wuauserv",{Verb="runas"})
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Run As Administrator

Post by xabierpayet »

nice, i try it, thanks mate
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Run As Administrator

Post by xabierpayet »

here dont work our method n my project, i'm attempting to write in an EC (Embeded Controller)

write <register> <value> [options]
Write a byte to a EC register.
Register range: 0-255
Value range: 0-255

i can sed it via cmd in administrator mode without problem, but if i attempt to change the register via cmd without administrator mode or hollywood nothing change here
plouf
Posts: 467
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Run As Administrator

Post by plouf »

Command is correct however windows "security" is a mesh

Maybe nnex to run script in elevated rights as well ?
Christos
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Run As Administrator

Post by xabierpayet »

i tried to compile the script as an exe file and launch it as administrator, the same result
Weird
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Run As Administrator

Post by Flinx »

Maybe your "write" command depends from anything in the environment (path for example) that the Hollywood script does not know?
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Run As Administrator

Post by xabierpayet »

no, the command is in the right place, all this is correct here
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Run As Administrator

Post by Flinx »

Did you change the current directory to the place where this write.exe is?
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: Run As Administrator

Post by xabierpayet »

yes ithe exe is in the same drawer, where i have the executable
Post Reply