Solved

PowerShell to List Local Group Membership

Posted on 2014-12-15
4
416 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

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 70

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 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