I was looking for a managedby
field for AD groups using:
get-adgroup -filter{name -like ‘’}
How about if we have a list of multiple groups using a wild card and we need the "managed by" properties for all of them?
I tried using a txt to store group names (again, all group names have *
) and then getting the details, but it doesn’t work.
Get-adgroup
-filter{name -like ‘test*’}
-properties Name,Description,ManagedBy |
ForEach-Object{
$user=Get-AdOject $_.ManagedBy
-Properties DisplayName,Description,SamAccountName,Name [pscustomobject]@{
GroupName = $_.Name
GroupDescription = $_.Description
ManagerSamAccountName = $user.SamAccountName
ManagerName = $user.Name
}
} |
Export-csv “ Path” -Notypeinformation
I need to get GroupName
, GroupDescription
, Managed by (SamAccountName
) , Managed by (UserName
). Could somebody help me with a script that could extract these details in a CSV format given that a text file would have names of the group for which the above details are required?