mirror of
https://github.com/sstent/Scripts.git
synced 2026-01-27 07:33:01 +00:00
added scripts and SUPERMICRO
This commit is contained in:
62
pinglist.ps1
Normal file
62
pinglist.ps1
Normal file
@@ -0,0 +1,62 @@
|
||||
$erroractionpreference = "SilentlyContinue"
|
||||
$a = New-Object -comobject Excel.Application
|
||||
$a.visible = $True
|
||||
|
||||
$b = $a.Workbooks.Add()
|
||||
$c = $b.Worksheets.Item(1)
|
||||
|
||||
$c.Cells.Item(1,1) = "Server"
|
||||
$c.Cells.Item(1,2) = "IP Address"
|
||||
$c.Cells.Item(1,3) = "WB Ping Status"
|
||||
$c.Cells.Item(1,4) = "NY Ping Status"
|
||||
|
||||
$d = $c.UsedRange
|
||||
$d.Interior.ColorIndex = 19
|
||||
$d.Font.ColorIndex = 11
|
||||
$d.Font.Bold = $True
|
||||
$d.EntireColumn.AutoFit($True)
|
||||
|
||||
$intRow = 2
|
||||
|
||||
$list = Import-Csv C:\Serverlist1.txt
|
||||
#$colComputers = get-content C:\Serverlist1.txt
|
||||
foreach($entry in $list)
|
||||
#foreach ($strComputer in $colComputers)
|
||||
{
|
||||
$entry.IPAddress
|
||||
$c.Cells.Item($intRow, 1) = $entry.ServerName
|
||||
$c.Cells.Item($intRow, 2) = $entry.IPAddress
|
||||
|
||||
#ServerName,IPAddress
|
||||
$ping = new-object System.Net.NetworkInformation.Ping
|
||||
$Reply = $ping.send($entry.ServerName)
|
||||
if ($Reply.status <EFBFBD>eq <EFBFBD>Success<EFBFBD>)
|
||||
{
|
||||
$c.Cells.Item($intRow, 4) = <EFBFBD>Online<EFBFBD>
|
||||
}
|
||||
else
|
||||
{
|
||||
$c.Cells.Item($intRow, 4) = "Offline"
|
||||
}
|
||||
$Reply = ""
|
||||
|
||||
|
||||
|
||||
|
||||
# $Reply = $ping.send($entry.IPAddress)
|
||||
# if ($Reply.status <20>eq <20>Success<73>)
|
||||
# {
|
||||
# $c.Cells.Item($intRow, 3) = <20>Online<6E>
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $c.Cells.Item($intRow, 3) = "Offline"
|
||||
# }
|
||||
# $Reply = ""
|
||||
|
||||
|
||||
$intRow = $intRow + 1
|
||||
|
||||
# }
|
||||
$d.EntireColumn.AutoFit()
|
||||
}
|
||||
Reference in New Issue
Block a user