PowerShell获取当前用户的权限

 

function
Get-CurrentUserRoles {

 

$SecurityPrinciple
=
New-Object
-TypeName
System.Security.Principal.WindowsPrincipal
-ArgumentList ([System.Security.Principal.WindowsIdentity]::GetCurrent())

 

$RolesHash
= @{}

 

[System.Enum]::GetNames("¡ãSystem.Security.Principal.WindowsBuiltInRole"¡À) |
ForEach-Object {

 

$RolesHash[$_]
=

$SecurityPrinciple.IsInRole([System.Security.Principal.WindowsBuiltInRole]::$_)

 

}

 

$RolesHash

 

}

 

Get-CurrentUserRoles

上一篇:Failed to load or instantiate


下一篇:Ubuntu Server 12.04下部署glusterfs