Posted in
Windows Powershell |
No Comment | 6,848 views | 29/01/2014 11:05
You can get your HP Server information with following script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
| function Get-HPServerInfo {
param (
# Server Name or IP Address
[Parameter(
Mandatory = $true,
HelpMessage = 'Server Name or IP Address')]
$Server
)
# Enable Silent Mode
$ErrorActionPreference = "silentlycontinue"
# Server Information
$Hostname = (Get-WmiObject -Computername $Server Win32_ComputerSystem).Name
$ServerInfo = Get-WmiObject -ComputerName $Server -Class Win32_ComputerSystem
$ServerManufacturer = $ServerInfo.Manufacturer
$ServerModel = $ServerInfo.Model
if (!$ServerModel)
{
$ServerModel = "No Model Info"
}
# Serial Number
$SerialNumber = (Get-WmiObject -ComputerName $Server -Class Win32_Bios).SerialNumber
$SerialNumber = $SerialNumber.Replace(" ","")
if (!$SerialNumber)
{
$SerialNumber = "No Serial Number"
}
# ILO Information
$ILOInfo = Get-WmiObject -Computer $Server -Namespace root\hpq -Class HP_ManagementProcessor
if ($ILOInfo)
{
$ILOIPAddress = $ILOInfo.IPAddress
$ILOURL = $ILOInfo.URL
}
else
{
$ILOIPAddress = "Not available"
$ILOURL = "Not available"
}
$Properties = New-Object Psobject
$Properties | Add-Member Noteproperty Hostname $Hostname
$Properties | Add-Member Noteproperty Manufacturer $ServerManufacturer
$Properties | Add-Member Noteproperty Model $ServerModel
$Properties | Add-Member Noteproperty SerialNumber $SerialNumber
$Properties | Add-Member Noteproperty ILOIPAddress $ILOIPAddress
$Properties | Add-Member Noteproperty ILOURL $ILOURL
Write-Output $Properties
} |
function Get-HPServerInfo {
param (
# Server Name or IP Address
[Parameter(
Mandatory = $true,
HelpMessage = 'Server Name or IP Address')]
$Server
)
# Enable Silent Mode
$ErrorActionPreference = "silentlycontinue"
# Server Information
$Hostname = (Get-WmiObject -Computername $Server Win32_ComputerSystem).Name
$ServerInfo = Get-WmiObject -ComputerName $Server -Class Win32_ComputerSystem
$ServerManufacturer = $ServerInfo.Manufacturer
$ServerModel = $ServerInfo.Model
if (!$ServerModel)
{
$ServerModel = "No Model Info"
}
# Serial Number
$SerialNumber = (Get-WmiObject -ComputerName $Server -Class Win32_Bios).SerialNumber
$SerialNumber = $SerialNumber.Replace(" ","")
if (!$SerialNumber)
{
$SerialNumber = "No Serial Number"
}
# ILO Information
$ILOInfo = Get-WmiObject -Computer $Server -Namespace root\hpq -Class HP_ManagementProcessor
if ($ILOInfo)
{
$ILOIPAddress = $ILOInfo.IPAddress
$ILOURL = $ILOInfo.URL
}
else
{
$ILOIPAddress = "Not available"
$ILOURL = "Not available"
}
$Properties = New-Object Psobject
$Properties | Add-Member Noteproperty Hostname $Hostname
$Properties | Add-Member Noteproperty Manufacturer $ServerManufacturer
$Properties | Add-Member Noteproperty Model $ServerModel
$Properties | Add-Member Noteproperty SerialNumber $SerialNumber
$Properties | Add-Member Noteproperty ILOIPAddress $ILOIPAddress
$Properties | Add-Member Noteproperty ILOURL $ILOURL
Write-Output $Properties
}
Example usage:
PS C:\Windows\system32> Get-HPServerInfo 192.168.198.164
Hostname : HYPERVHOST01
Manufacturer : HP
Model : ProLiant BL660c Gen8
SerialNumber : VCX5786922
ILOIPAddress : 192.40.2.208
ILOURL : https://192.40.2.208
You should install HP tools on your server to get ILO information.