I am lost I need to write a query to give me all the groups that a user is the owner of in a CSV format. An alternative would be a list of all groups with their username and e-mail.
The CSV format should either be:
"GroupName", ,"givenname","surname","office","mail",
or (preferred)
"givenname","surname","office","mail","group1","group2","group3",etc...
I tried the following but it didn't work.
$test = 'OU=Practice Office,DC=us,DC=LMCorp,DC=com'
$test | ForEach {
Get-ADGroup -Filter * -Properties ManagedBy -SearchBase $_
} | Select Name, ManagedBy,objectGUID,memberOf,givenname,surname,office,mail,title,telephoneNumber,department | Sort -Property Name | Out-File C:\temp\1.csv