Windows Automatic Multiple User login command line
Use Invoke-Command
to execute commands against a remote computer which also has Powershell, and has WinRM enabled. Invoke-Command
can also run non-Powershell commands.
# users stored in csv with "username, password" formatforeach ($user in $userlist) { Invoke-Command "runas /profile /credentials $creds /user:$user.username /password:$user.password *executable*}
Use the -asJob
parameter to run them as separate jobs, or run them in sequence for simplicity. Remote PSSessions are another possiblilty to consider if you need to run multiple commands. Research storing credentials, encrypted, in a file for repeated use.
This is actually not possible, you cannot log in to multiple accounts in command line. RDC is the only feasible way. May be you can automate the RDC for multiple users using other automation softwares like auto it, WSH scripting or some macro recorders. Which might help resolve some effort in your work.