Is there a similar Linux su command in Windows command line? If not, what about:
- in Powershell?;
- a workaround with a *.vbs script?;
- a workaround with some of the sysinternals tools like "psexec.exe"?
Note: I am using a netcat remote shell connection, so I am not able to insert password when requested by command "runas".
Note2: "sudo" and "su" commands are different commands. "sudo" executes commands as another user. "su" changes the effective user.
Note3: Despite finding an answer to my specific issue, The answer to this question, as mentioned by @Ramhound is "not possible"
122 Answers
In Windows you have the runas command. Try this:
Navigate to c:\windows\system32.
Enter the following command: runas /user:computer_name\account_name explorer.exe
This one worked for me
user@server C:\Windows\System32> runas /user:Administrator "dir C:\Users\Administrator"So something like runas /user:MyUser "command"