|
Tuesday, January 24, 2006
A Clone of id/whoami in MSH
##############################################Output looks like:
# File Name: id.msh
# Return User and Group information of current logon user
# By Tony http://mshforfun.blogspot.com
##############################################
$me=[System.Security.Principal.WindowsIdentity]::GetCurrent()
"UserSID= " + $me.User + " (" + $me.Name + ")"
"AuthenticationType= " + $me.AuthenticationType
"ImpersonationLevel= " + $me.ImpersonationLevel
"Token= " + $me.Token
"Groups= "
foreach($Group in $me.Groups)
{
"`tGroupSID= " + $Group + " (" + $Group.Translate([System.Security.Principal.NTAccount]) + ")"
}
UserSID= S-1-5-21-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxx (Domain\me)
AuthenticationType= NTLM
ImpersonationLevel= None
Token= xxxx
Groups=
GroupSID= S-1-5-21-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxx (Domain\None)
GroupSID= S-1-1-0 (Everyone)
GroupSID= S-1-5-32-545 (BUILTIN\Users)
GroupSID= S-1-5-4 (NT AUTHORITY\INTERACTIVE)
GroupSID= S-1-5-11 (NT AUTHORITY\Authenticated Users)
GroupSID= S-1-2-0 (LOCAL)
Well, write a clone of who would be fun. Any volunteer?
[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]
Tags: msh monad PowerShell
Post a Comment