{"id":17852,"date":"2008-12-02T11:32:55","date_gmt":"2008-12-02T19:32:55","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17852"},"modified":"2019-06-07T11:35:35","modified_gmt":"2019-06-07T19:35:35","slug":"get-me-ps1","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/get-me-ps1\/","title":{"rendered":"Get-Me.ps1"},"content":{"rendered":"<p><P>On an internal mailing list someone asked how to get the SID for the current context using PowerShell.&nbsp; <SPAN style=\"FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA\">Chris Bell\u00e9e correctly responded:<\/SPAN><\/P><SPAN style=\"FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA\">\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><FONT size=3><FONT face=Calibri>([Security.Principal.WindowsIdentity]::GetCurrent()).user.accountdomainsid.value<\/FONT><\/FONT><\/SPAN><\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><FONT size=3><FONT face=Calibri><\/FONT><\/FONT><\/SPAN>&nbsp;<\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><FONT size=3><FONT face=Calibri>I used this to create a script:&nbsp; Get-Me.ps1<\/FONT><\/FONT><\/SPAN><\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><FONT size=3 face=Calibri># Get-Me.ps1<\/FONT><\/SPAN><\/P><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><FONT size=3 face=Calibri>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><FONT size=3><FONT face=Calibri>[Security.Principal.WindowsIdentity]::GetCurrent()<\/FONT><\/FONT><\/SPAN><\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU><\/SPAN>&nbsp;<\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU>PS&gt; .\\get-me.ps1<\/SPAN><\/P><SPAN style=\"COLOR: #1f497d; mso-ansi-language: EN-AU\" lang=EN-AU>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal><BR>AuthenticationType : NTLM<BR>ImpersonationLevel : None<BR>IsAuthenticated&nbsp;&nbsp;&nbsp; : False<BR>IsGuest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : False<BR>IsSystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : False<BR>IsAnonymous&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : False<BR>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : JPSLAP14\\Guest<BR>Owner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : S-1-5-21-2812635655-1585162248-3907382133-501<BR>User&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : S-1-5-21-2812635655-1585162248-3907382133-501<BR>Groups&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : {S-1-5-21-2812635655-1585162248-3907382133-513, S-1-1-0, S<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -1-5-32-546, S-1-5-32-545&#8230;}<BR>Token&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1128<BR><\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal mce_keep=\"true\">&nbsp;<\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal>Simple &#8211; Useful &#8211; PowerShell \ud83d\ude42<\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal mce_keep=\"true\">&nbsp;<\/P>\n<P style=\"MARGIN: 0in 0in 0pt\" class=MsoNormal>Jeffrey Snover [MSFT]<BR>Windows Management Partner Architect<BR>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <A href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/A><BR>Visit the Windows PowerShell ScriptCenter at:&nbsp; <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/A><BR><\/P><\/SPAN><\/FONT><\/SPAN><\/SPAN><\/p>\n","protected":false},"excerpt":{"rendered":"<p>On an internal mailing list someone asked how to get the SID for the current context using PowerShell.&nbsp; Chris Bell\u00e9e correctly responded: ([Security.Principal.WindowsIdentity]::GetCurrent()).user.accountdomainsid.value &nbsp; I used this to create a script:&nbsp; Get-Me.ps1 # Get-Me.ps1 [Security.Principal.WindowsIdentity]::GetCurrent() &nbsp; PS&gt; .\\get-me.ps1 AuthenticationType : NTLMImpersonationLevel : NoneIsAuthenticated&nbsp;&nbsp;&nbsp; : FalseIsGuest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : FalseIsSystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : FalseIsAnonymous&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : FalseName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : JPSLAP14\\GuestOwner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : S-1-5-21-2812635655-1585162248-3907382133-501User&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17852","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>On an internal mailing list someone asked how to get the SID for the current context using PowerShell.&nbsp; Chris Bell\u00e9e correctly responded: ([Security.Principal.WindowsIdentity]::GetCurrent()).user.accountdomainsid.value &nbsp; I used this to create a script:&nbsp; Get-Me.ps1 # Get-Me.ps1 [Security.Principal.WindowsIdentity]::GetCurrent() &nbsp; PS&gt; .\\get-me.ps1 AuthenticationType : NTLMImpersonationLevel : NoneIsAuthenticated&nbsp;&nbsp;&nbsp; : FalseIsGuest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : FalseIsSystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : FalseIsAnonymous&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : FalseName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : JPSLAP14\\GuestOwner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : S-1-5-21-2812635655-1585162248-3907382133-501User&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17852","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17852"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17852\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17852"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17852"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17852"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}