Elevated & Remote Commands

email me

Combining Cpau and Psexec can prove to be quite a powerful combination.

This is how you would launch a process in elevated security…and also remotely launch a file.

CPAU
Use cpau.exe to change the security context and launch the local script. Note, I also pass the PC name to the remote.cmd using strComputer1

objShell.Run “%comspec% /c cpau.exe -u %computername%\administrator -p PASSWORD_HEREĀ -ex “”remote.cmd ” & strComputer1 & chr(34) & ” -lwop -hide”,0,false

 

PSEXEC
The contents of the remote.cmd (how you launch a script remotely using psexec)

@echo off

if not “%1” == [] set PC=%1
if “%1” == [] exit /b 0

rem sets PC name – it was passed from the VBScript/HTA above
SET PC=%1

rem copies your script to the remote computer
copy /y script.cmd \\%PC%\c$\windows\system32
Menu\Programs\Startup\”

rem launches the script remotely
psexec \\%PC% /accepteula -d -s script.cmd