Liste aller Gruppen

Eine ausführliche Liste aller Gruppen im AD bekommt man mit folgendem Script:

import-moduleactivedirectory
$GroupList=Get-ADGroup-Filter*-PropertiesName,DistinguishedName, `
GroupCategory,GroupScope,whenCreated,whenChanged,member, `
memberOf,sIDHistory,SamAccountName,Description|
Select-ObjectName,DistinguishedName,GroupCategory,GroupScope, `
whenCreated,whenChanged,member,memberOf,SID,SamAccountName, `
Description, `
@{name=’MemberCount’;expression={$_.member.count}}, `
@{name=’MemberOfCount’;expression={$_.memberOf.count}}, `
@{name=’SIDHistory’;expression={$_.sIDHistory -join’,’}}, `
@{name=’DaysSinceChange’;expression=`
{(\[.*\])::Round((New-TimeSpan$_.whenChanged).TotalDays,0)}} |
Sort-ObjectName

$GroupList|
Select-ObjectName,SamAccountName,Description,DistinguishedName, `
GroupCategory,GroupScope,whenCreated,whenChanged,DaysSinceChange, `
MemberCount,MemberOfCount,SID,SIDHistory|

    Export-CSV.\GroupList.csv-NoTypeInformation

 

Schreibe einen Kommentar