79359313

Date: 2025-01-15 18:30:19
Score: 0.5
Natty:
Report link

this may help....

I have no idea how this works, but if you run it (as a non admin) it grants admin rights and runs the thing as an admin - fairly bonkers but it does work!. I found it on the net ages ago, its not my work. you can just save the code below and run it.

save your actual file as a .bat and put it in the bit where it says "c:\tools\powershell\runmyscriptasanadmin.bat"

if %1==payload goto :payload

:getadmin echo %~nx0: elevating self set vbs=%temp%\getadmin.vbs echo Set UAC = CreateObject^("Shell.Application"^) >> "%vbs%" echo UAC.ShellExecute "%~s0", "payload %~sdp0 %*", "", "runas", 1 >> "%vbs%" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" goto :eof

:payload echo %~nx0: running payload with parameters: echo %* echo --------------------------------------------------- cd /d %2 shift shift

 rem put your code here like if _%1_==_payload_  goto :payload

:getadmin echo %~nx0: elevating self set vbs=%temp%\getadmin.vbs echo Set UAC = CreateObject^("Shell.Application"^) >> "%vbs%" echo UAC.ShellExecute "%~s0", "payload %~sdp0 %*", "", "runas", 1 >> "%vbs%" "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" goto :eof

:payload echo %~nx0: running payload with parameters: echo %* echo --------------------------------------------------- cd /d %2 shift shift

 rem put your code here like c:\tools\powershell\runmyscriptasanadmin.bat   

goto :eof rem e.g.: perl myscript.pl %1 %2 %3 %4 %5 %6 %7 %8 %9 goto :eof

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Filler text (0.5): ---------------------------------------------------
  • Filler text (0): ---------------------------------------------------
  • Low reputation (1):
Posted by: user29214574