Hello,
I'm working on a script that will run as a scheduled task. It parses out AD and checks for enabled users within two specific OUs. If a user is enabled when it is run, it shoots off an email. However, my conditional to not send an email if no one is enabled is not working. Can anybody tell me what I am missing?
ENABLED_USERS.PS1
Powershell
Import-ModuleActiveDirectory$CONF_LINES=Get-Content"ENABLED_USERS.conf"$time=Get-Date-formatg$PARAMETERS=@{}ForEach($LINEin$CONF_LINES){$PARAMETER=[regex]::split($LINE,':')If($PARAMETER[0].CompareTo("")-ne0){$PARAMETERS.Add($PARAMETER[0],$PARAMETER[1])}}$NUM=0ForEach($OUin$PARAMETERS.OU1,$PARAMETERS.OU2){try{$USERS=Get-ADUser-filter*-SearchBase$OU-ErrorAction'SilentlyContinue'|where{$_.enabled-eq$True}}catch{}If($?-eq$False){Write-Host...