Hi
I'm trying to make a script to run multiple commands depending on whether the equipment is online or not, but I get an error in the "else".
Any idea?
$serverlist = get-content “$path\servers.txt”
foreach ($server in $serverlist){
$result = Test-Connection $server -Count 1 -Quiet
if ($result -eq “True”){
{.\psexec.exe \\$server -S gpupdate.exe /target:computer /force}
Start-Sleep -Seconds 5
}
}
else
{
Add-Content “$path\noping.txt” -Value $server
}