If you're a domain administrator but don't know the target user's password, there is no direct way to switch to that user in Windows CMD.
However, you can try the following methods:
- Use the runas command: This requires entering the target user's password.
- runas /user:DOMAIN\username "cmd.exe"
- Use PsExec: This also requires entering the target user's password.
- psexec \remote_computer -u DOMAIN\username -p password cmd
- Use a Scheduled Task: You can create a scheduled task on the target machine to run commands as the target user and trigger the task remotely.
- Use WMI: Again, you need the target user's password.
- wmic /node:remote_computer /user:DOMAIN\username /password:password process call create "cmd.exe /c your_command"
In summary, if you don't know the password, you cannot directly switch users, but you can use some tools to execute commands as another user as long as you have the password.
Windows Client for IT Pros and Windows Server forums are moving to Microsoft Q&A
We’re transitioning to Microsoft Q&A for a more streamlined experience. Starting February 26th*, new questions can only be posted on* Microsoft Q&A. Existing discussions will remain accessible here.
Beginning March 3rdcustomers looking for support on Answers will be automatically redirected to Microsoft Q&A