Skip to content

Instantly share code, notes, and snippets.

@mikerodionov
Last active December 19, 2018 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikerodionov/445df6783f92603aac53c73981c42fb3 to your computer and use it in GitHub Desktop.
Save mikerodionov/445df6783f92603aac53c73981c42fb3 to your computer and use it in GitHub Desktop.
ADDSCHK
# ADDS Domain quick check
# v.1.0
# Mikhail Rodionov - mikerodionov.com
Function ADDSCHK ()
{
$pc=hostname
$PC_OU=(Get-ADComputer $pc).DistinguishedName
#Get total number of users (enabled and disabled)
$TNU=(Get-ADUser -filter *).count
#Get total number of enabled users
$TNEU=(Get-AdUser -filter * |Where {$_.enabled -eq "True"}).count
#Get total number of disabled users
$TNDU=(Get-ADUser -filter * |Where {$_.enabled -ne "False"}).count
#Get number of groups
$TNG=(Get-ADGroup -filter *).count
#Get Forest Functional Level
$FFL=(Get-ADForest).ForestMode
#Get Domain Functional Level
$DFL=(Get-ADDomain).DomainMode
write-host 'Current server organizational unit:' $PC_OU -ForegroundColor Green
write-host 'Total number of domain users is:' $TNU -ForegroundColor Green
write-host 'Total number of enabled domain users is:' $TNEU -ForegroundColor Green
write-host 'Total number of disabled domain users is:' $TNDU -ForegroundColor Green
write-host 'Total number of domaim groups is:' $TNG -ForegroundColor Green
write-host 'Forest Functional Level is:' $FFL -ForegroundColor Green
write-host 'Domain Functional Level is:' $DFL -ForegroundColor Green
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment