PowerShell Nuggets
Wednesday, May 3, 2017
Is the current user a local admin?
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(`
[Security.Principal.WindowsBuiltInRole] “Administrator”))
{
Write-Warning “<ERROR MESSAGE GOES HERE>”
Break
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment