0% found this document useful (0 votes)
14 views

Server Updown Code

Uploaded by

r19512695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Server Updown Code

Uploaded by

r19512695
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

$ip_format = "172.17.

168"
$node_num = 1

$DownNodes = @()
$UpNodes = @()

$down_count = 0
$up_count = 0

for($x=6; $x -le 255; $x++){

$ip = "$ip_format.$x"
#Write-Host $ip

if(Test-Connection $ip -Count 1 -ErrorAction SilentlyContinue){


Write-Host "HGX Node $node_num : $ip ==> Up!"
$UpNodes+="HGX Node $node_num : $ip ==> Up!"
$up_count+=1
}else {

Write-Host "HGX Node $node_num : $ip ==> Down!"


$DownNodes+="HGX Node $node_num : $ip ==> Down!"
$down_count+=1
}
$node_num++
}

Write-Host
Write-Host

# Print Up Nodes
Write-Host "Up Nodes!"
Write-Host "========="

for($x=0; $x -le $UpNodes.Length - 1; $x++){


Write-Host $UpNodes[$x]

}
Write-Host "Up Count : $up_count"

Write-Host
Write-Host

# Print Up Nodes
Write-Host "Down Nodes!"
Write-Host "=========="

for($x=0; $x -le $DownNodes.Length - 1; $x++){


Write-Host $DownNodes[$x]

}
Write-Host "Down Count : $down_count"

You might also like