Running PowerShell under “run-as” or elevated privileges


There are times when I am in a PowerShell session and pass another set of credentials when I use connect-qadservice cmdlet to connect to another domain with the –credential parameter, however often times I would launch the PowerShell under “run-as” with the elevated credentials and launch a native session and I would have multiple session going at the same time. For latter scenario, I needed a way to identify which is which to adhere to a safe practice. There are probably other ways to tackle this but you can create PowerShell profile in each of your elevated session and change the look and feel as below.

Launch the PowerShell under run-as and run this :

new-item -path $profile -type file -force

notepad $profile

And add the following line into your profile


You may also want to add a different ‘window’ title for your admin session, you can add this.

$a = (Get-Host).UI.RawUI
$a.WindowTitle = “Admin Session”

Save the changes in the notepad and launch your elevated PowerShell session to see the results.


See this for more changes and tweaks you can do to a PowerShell console.

Leave a Reply

Your email address will not be published. Required fields are marked *