Get-Me.ps1

Get-Me.ps1

  • Comments 3

On an internal mailing list someone asked how to get the SID for the current context using PowerShell.  Chris Bellée correctly responded:

([Security.Principal.WindowsIdentity]::GetCurrent()).user.accountdomainsid.value

 

I used this to create a script:  Get-Me.ps1

# Get-Me.ps1

[Security.Principal.WindowsIdentity]::GetCurrent()

 

PS> .\get-me.ps1


AuthenticationType : NTLM
ImpersonationLevel : None
IsAuthenticated    : False
IsGuest            : False
IsSystem           : False
IsAnonymous        : False
Name               : JPSLAP14\Guest
Owner              : S-1-5-21-2812635655-1585162248-3907382133-501
User               : S-1-5-21-2812635655-1585162248-3907382133-501
Groups             : {S-1-5-21-2812635655-1585162248-3907382133-513, S-1-1-0, S
                     -1-5-32-546, S-1-5-32-545...}
Token              : 1128

 

Simple - Useful - PowerShell :-)

 

Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at:    http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:  http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx

Leave a Comment
  • Please add 8 and 3 and type the answer here:
  • Post
  • Jeffery Snover just posted a Get-Me script .  The Get-Me script finds out the principal of the user

  • What, no friendly names for your SIDs?  Slacker!  *grin*

  • The difference between this command and $NTIdentity would be?

Page 1 of 1 (3 items)