Hello,
You can view the number of RID used like that :
$domain=[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$domainDN="DC="+$domain.name.ToUpper().replace(".",",DC=")
$searcher=[adsisearcher][adsi]"LDAP://CN=RID Manager$,CN=System,$domainDN"
$property=($searcher.FindOne()).properties.ridavailablepool
[int32]$totalSIDS = $($property) / ([math]::Pow(2,32))
[int64]$temp64val = $totalSIDS * ([math]::Pow(2,32))
[int32]$currentRIDPoolCount = $($property) - $temp64val
$ridsremaining = $totalSIDS - $currentRIDPoolCount
"Used RID : $currentRIDPoolCount"
"RID left : $ridsremaining"