The piece of script that should be passing the server name is below, the Item listed ($Servers = $input) seemed to be the culprit, I removed the S and it fixed the script:
Prompt user for dc or txt file with list of DCs
$cwd = Get-Location
$TextFileInput = "*.txt"
$ServerInput = "*0*"
$matchFound = $null
###Validate input
while($validParamPassed -ne $true)
{
$input = (Read-Host "Please enter the name of the DC, a txt file, or a domain. Ex. DC_Name, servers.txt, ED. Note: The txt file must be in the same directory as the script."`n)
switch($input)
{
{$_ -like $TextFileInput}
{
$servers = Get-Content "$cwd\$input"
$validParamPassed = $true
break
}
{$_ -like $ServerInput}
{
$Servers = $input
$validParamPassed = $true
break
}
#Validate that the DC is a DC in the forest that the healthcheck script is being executed in.
{$_ -like "*"}
{
$domains = ([system.directoryservices.activedirectory.forest]::getcurrentforest().Domains).name
foreach($domain in $domains)
{
if($domain -match $input)
{
$matchFound = $true
}
}
if($matchFound)
{
$DCs = [system.directoryservices.activedirectory.forest]::getcurrentforest().Domains | ForEach-Object {$_.DomainControllers} | Select Name -ExpandProperty Name
$Servers = $DCs -match $input
$validParamPassed = $true
break
}
}
default {Write-Host -ForegroundColor Red "Please enter valid input!";$validParamPassed = $false}
}
}
Clear-Host
$now = Get-Date
$string_now = $now.tostring("MM-dd-yyyy_HHmmss")
$admin = whoami
$logpath = "$CWD\DCHealthCheckLogs\"
$pathtest = Test-Path $logpath
if ($pathtest -eq $false)
{
Write-Host "Creating $logpath Directory"
New-Item -Path $logpath -type directory | Out-Null
}
$logfile = "$logpath" + "DCHealthCheck" + "$string_now" + ".html"
"`nStarting the Domain Controller Heath Check Script"
"Initiated by: $admin"
"Current Date/Time: $now"