Just want to ask why did you skip gid 8000?
https://github.com/joerod/powershell/blob/836108aaa4173fe7cecbe6b120a16cdfaa374c06/ad_unix_attributes.ps1#L20
First thanks for sharing your code. I'm going to use it to assign gids to my groups.
I just wanted to asked what the reason was for skipping gid 8000? Is this an internal issue you have or is there something special with that gid?
Also, I changed to piping to Sort-Object and without specifying the property gid to get it to work for me.
$next = ((Get-ADObject -SearchBase "OU=Groups,DC=US,DC=DOMAIN,DC=LOCAL" -filter {gidnumber -like "*"} -Properties gidnumber).gidnumber | Sort-Object)[-1]
Thanks,
Michael
Sorry for the long wait, if I remember correctly this GID was being used specifically for an account at the company I was working for.