...$dept = Read-Host -Prompt 'You can only choose one Department to scan.'
if ($subsite -eq $null){
$infoColl = @()
Get-ADComputer -Filter * -server "domain controller" -SearchBase "OU=$site, OU=$mainOU, DC=MyCompany, DC=net" | Foreach-object{Rest of code}
}...