• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 70
  • Last Modified:

powershell script

Hi i am new to powershell and need to write a script that can pull group memberships of users that are in the disabled users groups can you help?
0
JT3865
Asked:
JT3865
1 Solution
 
Rich LeclairCommented:
Without knowing how you want this formatted the quickest and easiest way I could think of doing this is to export a csv file for each user. Please see script below.

$users = Get-ADGroupMember -identity Helpdesk | select -ExpandProperty Name

foreach ($user in $users){
Get-ADPrincipalGroupMembership -identity $user | select Name | export-csv -NoTypeInformation -path c:\output\$user-Groups.csv}

Open in new window

0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now