Last active
December 19, 2018 22:22
-
-
Save mikerodionov/445df6783f92603aac53c73981c42fb3 to your computer and use it in GitHub Desktop.
ADDSCHK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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