Who am I?

by May 22, 2012

If you'd like to know your current user account, of course you can query environment variables like this:

PS> $env:userdomain

PS> $env:username


You get a lot more information including your security identifier (SID) by using the appropriate .NET methods:

PS> [System.Security.Principal.WindowsIdentity]::GetCurrent()



PS> [System.Security.Principal.WindowsIdentity]::GetCurrent() |

PS> [System.Security.Principal.WindowsIdentity]::GetCurrent() |

PS> [System.Security.Principal.WindowsIdentity]::GetCurrent() |

Twitter This Tip! ReTweet this Tip!