Page 1 of 2

Run As Administrator

Posted: Sat May 27, 2023 11:30 am
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.

Re: Run As Administrator

Posted: Sat May 27, 2023 1:29 pm
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"})

Re: Run As Administrator

Posted: Sat May 27, 2023 3:42 pm
by xabierpayet
nice, i try it, thanks mate

Re: Run As Administrator

Posted: Sat May 27, 2023 9:41 pm
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

Re: Run As Administrator

Posted: Sun May 28, 2023 8:19 am
by plouf
Command is correct however windows "security" is a mesh

Maybe nnex to run script in elevated rights as well ?

Re: Run As Administrator

Posted: Sun May 28, 2023 9:45 am
by xabierpayet
i tried to compile the script as an exe file and launch it as administrator, the same result
Weird

Re: Run As Administrator

Posted: Sun May 28, 2023 10:28 am
by Flinx
Maybe your "write" command depends from anything in the environment (path for example) that the Hollywood script does not know?

Re: Run As Administrator

Posted: Sun May 28, 2023 12:03 pm
by xabierpayet
no, the command is in the right place, all this is correct here

Re: Run As Administrator

Posted: Sun May 28, 2023 1:36 pm
by Flinx
Did you change the current directory to the place where this write.exe is?

Re: Run As Administrator

Posted: Sun May 28, 2023 6:47 pm
by xabierpayet
yes ithe exe is in the same drawer, where i have the executable