Morning Everyone
I am new to this site and very much learning PowerShell, but i have a question about a script that i wish to run which is really doing my head in!
I want to export into a CSV file every single user that is part of all my AD Groups across my domain. Nested Groups i do not care much for but just the members.
I can export the SamAccountName of the groups to CSV with the following:
$ADGroups = Get-ADGroup -Filter "*" | Select SamAccountName | Out-File C:\Temp\AD.csv
This is fine.
And the basic Get-AdGroupMember | select SamAccountName is fine for one by one groups, but i want to create a loop
I have noticed however you can not WildCard the Get-AdGroupMember in the same way you can the Groups. So my question is do i use the Foreach cmdlet? if so what am i doing wrong :)
Is there a easy way to do this.
Machine OS: Win 7 64bit
Powershell Version: 2012
AD Module Loaded