Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = "username"
- $password = "password"
- $startWithElevatedRights = "notepad"
- $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
- Start-Process powershell -Credential $credentials -ArgumentList '-noprofile -command &{Start-Process ‘, $startWithElevatedRights, ‘ -Wait -verb runas}'
- $username = "username"
- $password = "password"
- $startWithElevatedRights = "notepad"
- $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
- $ps = Start-Process -PassThru -FilePath powershell -Credential $credentials -ArgumentList '-noprofile -command &{Start-Process ', $startWithElevatedRights, ' -Wait -verb runas}'
- $ps.WaitForExit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement