Экспорт информации об AD группах и их членов в csv файл:
$secGroups = get-adgroup -filter * |
select-object -expandproperty DistinguishedName | sort-object& { foreach ($secGroup in $secGroups) { $members = get-adgroupmember -identity $secGroup | select-object -expandproperty DistinguishedName | sort-object foreach ($member in $members) { "" | select-object @{Name="Group"; Expr={$secGroup}}, @{Name="Member"; Expr={$member}} } }} | export-csv GroupsAndMembers.csv -notypeinformation
select-object -expandproperty DistinguishedName | sort-object& { foreach ($secGroup in $secGroups) { $members = get-adgroupmember -identity $secGroup | select-object -expandproperty DistinguishedName | sort-object foreach ($member in $members) { "" | select-object @{Name="Group"; Expr={$secGroup}}, @{Name="Member"; Expr={$member}} } }} | export-csv GroupsAndMembers.csv -notypeinformation
Комментариев нет:
Отправить комментарий