Get-Me.ps1
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
0 comments