Created
January 12, 2014 20:38
-
-
Save martin9700/8390269 to your computer and use it in GitHub Desktop.
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
#Validate sources | |
Write-Host "Validating sources...`n" | |
$Keep = @() | |
ForEach ($Source in $Sources) | |
{ Write-host "$Source..." -NoNewline | |
If (-not (Get-WmiObject "Win32_ComputerSystem" -ComputerName $Source -ErrorAction SilentlyContinue)) | |
{ #Are you sure? | |
Start-Sleep -Milliseconds 500 | |
If (-not (Get-WmiObject "Win32_ComputerSystem" -ComputerName $Source -ErrorAction SilentlyContinue)) | |
{ Write-Host "BAD" -ForegroundColor Red | |
Write-Warning "$($Error[0])" | |
Write-Warning "Removing $Source from Source list" | |
} | |
Else | |
{ Write-Host "OK" | |
$Keep += $Source | |
} | |
} | |
Else | |
{ Write-Host "OK" | |
$Keep += $Source | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment