Hey Scripting Guy!
I've created the script (below) to use test-connection against a list of hosts and write the results of the machines that respond to a .txt file. The only issue is that one of my sites utilizes two separate domains, does anyone have any advice as far aswhen a test connection fails, retrying the command using another domain name? (server.domain.com)
I'll take any advice at this point... Thanks!
New-PSDrive -Name S -PSProvider FileSystem -Root \\server\share -ErrorAction SilentlyContinue
Get-ChildItem "S:\Folder1\Folder2\backup\backup Audits\Host Audits" -Filter *.txt | `
Foreach-Object{
$content = Get-Content $_.FullName
#$SiteName = Get-ChildItem "S:\Folder1\Folder2\backup\backup Audits\Host Audits"
#Find alive machines, and write their hostnames to output file for auditing
Test-Connection -count 5 -ErrorAction SilentlyContinue $Content | Select-object -unique | Out-File "S:\Folder1\Folder2\backup\backup Audits\Audit results by Site\$_"
}