Po walcę z grupami w linuxie, pora przyszła aby przejrzeć AD.
Jak się okazało, nie wszystkie grupy windowsowe miały odpowiednie parametry więc pora była na dopisanie tych paramtrów.
Z tego powodu narodził sie ponizszy skrypt:
$strRoot = "LDAP://dc=pjwstk,dc=edu,dc=pl"$Root = New-Object DirectoryServices.DirectoryEntry $strROOT$Searcher = New-Object DirectoryServices.DirectorySearcher$Searcher.SearchRoot = $root$searcher.Filter = "(&(objectClass=Group))"$groups = $searcher.findAll();#get groups with no mssfu30nameforeach ($group in $groups) { if (!$group.Properties.mssfu30name) {write-host $group.Properties.name }}#print maxgidforeach ($group in $groups) { if ($group.Properties.mssfu30name) {write-host $group.Properties.mssfu30gidnumber }}#setMaxgid$maxgid=0foreach ($group in $groups) { if ($group.Properties.mssfu30gidnumber) {$tmp = [int] $group.Properties.mssfu30gidnumber[0]if ($tmp -gt $maxgid ) {$maxgid=$tmp;}} };#set paramsforeach ($group in $groups) { if (!$group.Properties.mssfu30gidnumber) {$maxgid= $maxgid+1$de = new-object DirectoryServices.DirectoryEntry($group.Path)$deName=$de.InvokeGet("cn");$de.InvokeSet("mssfu30name",[string]$deName)$de.InvokeSet("mssfu30gidnumber",[int]$maxgid)$de.InvokeSet("mssfu30nisdomain",[string]"pjwstk")$de.CommitChanges()$de.close()} };
Remember Me