PowerShell Runas CmdLet

IT Support Forum Forums Windows Windows 7 Troubleshooting PowerShell Runas CmdLet

This topic contains 0 replies, has 1 voice, and was last updated by  Webmaster 4 years, 6 months ago.

  • Author
  • #1018


    Here’s a PowerShell cmdlet I’ve used to run IE 11 in kiosk mode, run as a different user:

    $username = ‘domain\username’
    $password = ‘password’
    $cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    Start-Process -FilePath “c:\Program Files\Internet Explorer\iexplore.exe” -LoadUserProfile -Credential $cred -ArgumentList “-K http://www.cheaphealthyrecipes.info

    The RunAs cmdlet does encrypt the password, but I’ve not found a way to decrypt the password if the script it run as a different user. Consequently, I’ve just ended up converting the PowerShell cmdlet to an exe file to conceal (not encrypt!) the password.

You must be logged in to reply to this topic.