Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

How do you get account that powershell session is being run under?

$
0
0
Anybody know a trick to do this?  The $env:profile returns the profile that is being used to logon to Windows.  I want to return the account that is being used to run the session when I do a "runas".  It would be nice to also get the domain that user is in too.  Why?  I run powershell command in multiple domains from my laptop and want to build a way to put the "runas" user name and domain in the window frame so that if I have multiple windows open for powershell I can see what domain I am in by looking at the frame title. 

Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>