How to run Start-Process in Powershell using user credentials? How to run Start-Process in Powershell using user credentials? powershell powershell

How to run Start-Process in Powershell using user credentials?


$username = "username"$password = "password"$credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))Start-Process dnscrypt-proxy.exe -WorkingDirectory path_here -Credential ($credentials)

--from powershell forums; i searched for this same solution just a couple days ago and this worked. hope it helps you.

Source: http://powershell.com/cs/forums/t/9502.aspx


Finally found the solution: by default, Jenkins is run as a service log on as the "Local System account". To change this launch the services application (type "services" in the start menu), look for Jenkins, double click on it and go to the "Log On" tab.

You should now see what account the service is using. Change to "This account" and fill in your account details and voila!

For the record the command I was originally trying to run works fine now, without having to add any of the "changing user" things on top.

Special thanks to @Poorkenny that put me on the correct track with his comment, THANK YOU! Stackoverflow rocks! (that moment when thanks to someone you just solved an issue that took you the whole day to figure it out...)