I see someone posted this small script for assigning Gid's but unfortunately im getting an error. I modified it a bit to better fit my needs but was wonder what the $groups variable meant in it? (See below)
I get an error whenever i try to run it
###Find the highest GID used on any group in the domain
$highGid = Get-ADGroup -Searchbase $searchbase -LDAPFilter "(gidNumber=*)" -Properties gidNumber |
Measure-Object -Property gidNumber -Maximum |
Select-Object -ExpandProperty Maximum
###Avoid assigning GIDs below 1000000
$highGid = [Math]::max( $highGid, 1000000 )
####Find every security group without a gidNumber, and give it one.
$groups = Get-ADGroup -SearchBase $searchbase -LDAPFilter "(!gidNumber=*)" | ? {$_.GroupCategory -eq "Security"}
$groups | Set-ADGroup -Add @{ gidNumber=++$highGid }