View Single Post
Old 09-03-2007   #3 (permalink)
IT Staff


 
 

Re: how to get logged-in user credentials?


[Security.Principal.WindowsIdentity]::getcurrent().name



"Hal Rottenberg" <hal@xxxxxx> wrote in message
news:%23jqEmnd7HHA.4584@xxxxxx
Quote:

> Replying to myself here... I found these useful bits in my profile which
> PSCX put there:
>
> Set-PscxVariable NTIdentity
> ([Security.Principal.WindowsIdentity]::GetCurrent())
>
> Set-PscxVariable NTAccount
> ($NTIdentity.User.Translate([Security.Principal.NTAccount]))
>
> 11# $ntaccount
>
> Value
> -----
> EL-GUAPO\Hal
>
> --
>
> Hal Rottenberg
> blog: http://halr9000.com
> powershell category:
> http://halr9000.com/article/category...ng/powershell/

My System SpecsSystem Spec