Hi, new here and fairly new to powershell / AD module so apologies if overly simple :/
I've a list of hundreds of users, they are all a member of a specific geographical group (for backup, call it XXXLondon, XXXLiverpool, XXXGlasgow etc). I'm trying to get list and so far get the output I want using...
Get-content c:\userlist_test.txt | ForEach-Object { Get-ADPrincipalGroupMembership $_ | select Name | Where-Object {$_.name -like '*XXX*' } }
This returns me a list of groups OK, but not with the usernames against them. (There may be users on list that aren't a member of any XXX group unfortunately!)
Is there something simple I can do to get the input from the pipe in the output? Can use out-file or export-csv, format not important as it's going to be a manual task afterwards anyway. Thanks in advance. :)