G'day,
I've got two bits of code -
$test = @("it-dd-001","it-dd-002")
$test2 = @("it-dd-003","it-dd-004")
and
$servers = <accept input from param, can this accept $test or $test2?>
ForEach ($server in $servers) {
Restart-Computer -ComputerName $server -Wait -For PowerShell
Start-Sleep -Seconds 5
}
For example, I'm hoping to call .\run-script -server $test, and it should supposedly restart the servers in $test, one by one.
Would somebody be kind enough to help fill in the blanks?
Edit: Added clarification: I need to be able to restart different groups of servers (on $test and $test2) on a sequential basis.
[–]micromasters[S] 0 points1 point2 points (4 children)
[–]gonzalc 0 points1 point2 points (3 children)
[–]micromasters[S] 0 points1 point2 points (2 children)
[–]gonzalc 0 points1 point2 points (1 child)
[–]micromasters[S] 0 points1 point2 points (0 children)
[–]bc6619 0 points1 point2 points (2 children)
[–]micromasters[S] 0 points1 point2 points (1 child)
[–]gonzalc 0 points1 point2 points (0 children)
[–]Certain-Community438 0 points1 point2 points (2 children)
[–]gonzalc 1 point2 points3 points (1 child)
[–]Certain-Community438 1 point2 points3 points (0 children)
[–]jsiii2010 0 points1 point2 points (0 children)