Skip to content

Instantly share code, notes, and snippets.

@Dan1el42
Last active September 5, 2015 15:31
Show Gist options
  • Select an option

  • Save Dan1el42/29c5966ab7ec5c2f0d85 to your computer and use it in GitHub Desktop.

Select an option

Save Dan1el42/29c5966ab7ec5c2f0d85 to your computer and use it in GitHub Desktop.
Param
(
[Parameter(Mandatory = $true)]
[String] $ComputerName
)
# S-1-5-32-544 is the well-known security ID for the Administrators group
$LocalGroup = Get-WmiObject -Class Win32_Group -Filter "SID = 'S-1-5-32-544'" -ComputerName $ComputerName
if ($LocalGroup)
{
$LocalGroup.GetRelated('Win32_UserAccount')
$LocalGroup.GetRelated('Win32_Group')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment