<#
.SYNOPSIS
Gets local group members from a computer.
.DESCRIPTION
This script uses Win32_Group to get the local groups
on a system then displays those groups.
.NOTES
File Name : Get-LocalGroup.ps1
Author : Thomas Lee - tfl@psp.co.uk
Requires : PowerShell V2
.LINK
PowerShell sample at:
http://pshscripts.blogspot.co.uk/2008/11/get-localgroupsps1.html
.EXAMPLE
C:\foo> .\Get-LocalGroup.PS1
Name Sid SidType Status
---- --- ------- ------
Administrators S-1-5-32-544 4 OK
Backup Operators S-1-5-32-551 4 OK
Certificate Service… S-1-5-32-574 4 OK
Cryptographic Opera… S-1-5-32-569 4 OK
Distributed COM Users S-1-5-32-562 4 OK
Event Log Readers S-1-5-32-573 4 OK
Guests S-1-5-32-546 4 OK
IIS_IUSRS S-1-5-32-568 4 OK
Network Configuration … S-1-5-32-556 4 OK
Performance Log Users S-1-5-32-559 4 OK
Performance Monitor Us… S-1-5-32-558 4 OK
Power Users S-1-5-32-547 4 OK
Print Operators S-1-5-32-550 4 OK
Remote Desktop Users S-1-5-32-555 4 OK
Replicator S-1-5-32-552 4 OK
Users S-1-5-32-5 4 OK
SQLServer2005MSFTE… S-1-5-21-23769… 4 OK
SQLServer2005MSSQLSe… S-1-5-21-23769… 4 OK
SQLServer2005MSSQLUs… S-1-5-21-23769… 4 OK
SQLServer2005MSSQLUs… S-1-5-21-23769… 4 OK
SQLServer2005SQLBro S-1-5-21-23769… 4 OK
#>
##
# Start of script
##
# Get Win32 Group Accounts
$Accts = Get-WMIObject Win32_Group | Where-object {$_.LocalAccount}
# Display them
$accts | Format-Table Name, Sid, SidType, Status –Autosize
# End of script
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Wednesday 26 November 2008
Get-LocalGroup.ps1
Labels:
powershell,
PowerShell scripts,
Win32_Group,
wmi
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment