<# # Title: A simple automation to run a program under a different user # Author: Osanda Malith (@OsandaMalith) # Website: https://osandamalith.com #> add-type -AssemblyName microsoft.VisualBasic add-type -AssemblyName System.Windows.Forms $args = "/user:jane " + $args[0] Start-Process runas -ArgumentList $args start-sleep -Milliseconds 1000 [Microsoft.VisualBasic.Interaction]::AppActivate("runas.exe") [System.Windows.Forms.SendKeys]::SendWait("abc123{ENTER}")