How to start new process as another user from PowerShell and use the target user environment?
10:06 04 Dec 2025
runas /user:someuser /profile cmd

Starts cmd.exe as someuser and that user's environment. E.g. inside cmd.exe

>echo %USERNAME%
someuser

However, when I am trying to do a similar thing from PowerShell (because I need to supply the password) the new process inherits my environment instead breaking all kinds of things:

Start-Process -FilePath cmd.exe `
              -Credential $someuserCred -LoadUserProfile

then

>echo %USERNAME%
me

How do I run cmd.exe as someuser from PowerShell and supply the password, and have the cmd use someuser's environment instead of mine?

powershell