beautypg.com

Script writing methodology – HP Scripting Tools for Windows PowerShell User Manual

Page 19

background image

$sevcnts = $ilo.Bay[$b].Syslog | group-object -property SEVERITY –noelement
"There are " + $uniqsev.Count + " type(s) of events in the IML log in Bay $($b+1).”
$sevcnts | Format-Table
}
}
}
Disconnect-HPOA $conObj

Script output:

Warning : It might take a while to search all the HP OA servers if the input is a
very large range. Use Verbose for more information.
VERBOSE: Using 3 threads for search
VERBOSE: Pinging 192.168.242.63
VERBOSE: Pinging 192.168.242.64
VERBOSE: Pinging 192.168.242.65
VERBOSE: No system responds at 192.168.242.65
Bay 2 contains a HP ProLiant BL420c Gen8 Server Blade.
The OA at 192.168.242.63 retrieved 7 IML log entries from Bay 2.
There are 3 type(s) of events in the IML log in Bay 2.

Count Name
----- ----
4 Informational
1 Caution
2 Critical

Bay 4 contains a HP ProLiant BL660c Gen8 Server Blade.
The OA at 192.168.242.63 retrieved 13 IML log entries from Bay 4.
There are 2 type(s) of events in the IML log in Bay 4.

Count Name
----- ----
2 Informational
11 Caution

Bay 7 contains a HP ProLiant BL460c Gen8 Server Blade.
The OA at 192.168.242.63 retrieved 5 IML log entries from Bay 7.
There are 3 type(s) of events in the IML log in Bay 7.

Count Name
----- ----
3 Informational
1 Caution
1 Critical

Bay 4 contains a HP ProLiant BL620c G7 Server Blade.
The OA at 192.168.242.64 retrieved 119 IML log entries from Bay 4.
There are 2 type(s) of events in the IML log in Bay 4.

Count Name
----- ----
68 Informational
51 Critical

Script writing methodology

When deciding to write a script, you generally know what you want to accomplish. One of the
powerful features of PowerShell ISE is that you can build a script piece-by-piece, testing code and
viewing objects to get a better understanding how to accomplish what you want to do.

Here is a typical process you might want to use for creating PowerShell scripts.
1.

Determine what type of data you want to get.

Script writing methodology

19