PowerShell Runas CmdLet

IT Support Forum Forums Windows Windows 7 Troubleshooting PowerShell Runas CmdLet

Viewing 0 reply threads
  • Author
    Posts
    • #1018
      Webmaster
      Keymaster

      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.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.