RunAs as a different user

526 Views Asked by At

If I from an elevated cmd run the following line, I get the error: "740: The requested operation requires elevation." But the CMD I run it in, is elevated som how can I tell runas to elevate it or that it is elevated?

"C:\Windows\System32\runas.exe /savecred /noprofile /user:aloc-ad\teksupadmin "%windir%\System32\mmc.exe %windir%\System32\virtmgmt.msc""

I have also tried PowerShell: Start-Process -FilePath c:\Windows\System32\mmc.exe -ArgumentList c:\Windows\System32\virtmgmt.msc -Credential aloc-ad\teksupadmin

But with same result.

1

There are 1 best solutions below

2
Rowan On

Runas will check if the user you hand over to it has elevated rights. If the user (here teksupadmin) doesn't have elevated rights (or permissions in general) , the program wont run even when you started the cmd with elevated rights.