Skip to content

Instantly share code, notes, and snippets.

@leveled
Last active December 29, 2016 17:04
Show Gist options
  • Save leveled/bed601ef948c79e3b6a2773aa765eb29 to your computer and use it in GitHub Desktop.
Save leveled/bed601ef948c79e3b6a2773aa765eb29 to your computer and use it in GitHub Desktop.
Use powershell to run an executable file as another user on Windows
$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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment