Quantcast
Channel: Forum Microsoft Identity Manager
Viewing all articles
Browse latest Browse all 1070

Powershell script to list all groups of users with prefix

$
0
0

Hi All,

First time I use this forum :-0, anyhow I have a problem that I cannot get done in powershell.

I try to export all users with a prefix and their connected groups, meaning sAMaccountname, ADgroupname.

Get-ADUser -Filter {sAMAccountName -like "xx*" -and enabled -eq $true} | select sAMAccountName | foreach-object {
Get-ADPrincipalGroupMembership $_.SamAccountName | select name}

This script just provides me the groupname of all group of the users stating with XX, could somebody help me to get the SamAccountName & The groupname as output to excel?

Many times thanks!

Greets,

Mathijs


Viewing all articles
Browse latest Browse all 1070

Trending Articles