Solved

PowerShell to List Local Group Membership

Posted on 2014-12-15
4
343 Views
Last Modified: 2014-12-19
Is there a way with powershell in Windows Server 2008R2 to list all members of  a specific group? They are all local users within a local group. I can use net localgroup "GroupName" to get the usernames but that doesn't show me FullNames and Descriptions which I need to view as well.

Thanks!
0
Comment
Question by:Winsoup
  • 2
4 Comments
 
LVL 42

Expert Comment

by:Amit
ID: 40501036
0
 
LVL 3

Author Comment

by:Winsoup
ID: 40501154
That gets all local user accounts. I only want to get local user accounts within a certain group. I would also only like to display the Name, FullName, and Description if that's possible.
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40509461
$localgroup = 'Administrators'
gwmi -query "select PartComponent, __Server from Win32_GroupUser where GroupComponent=`"Win32_Group.Domain='$env:Computername',Name='$localgroup'`"" |
  % { [WMI] $_.PartComponent } |
  ft -a Domain, Name, FullName, Description

Open in new window

0
 
LVL 3

Author Closing Comment

by:Winsoup
ID: 40509499
Awesome, works perfect! Thank you!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
Set OWA language and time zone in Exchange for individuals, all users or per database.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question