Skip to main content

PowerShell script example to run a process as another user.

$username = 'user'
$password = 'password'

$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $username, $securePassword

Start-Process Notepad.exe -Credential $credential