-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSet-HPiLONetworkSetting.ps1
40 lines (26 loc) · 1015 Bytes
/
Set-HPiLONetworkSetting.ps1
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
Disable-HPiLOCertificateAuthentication
Set-HPiLOSessionTimeOut -Confirm -Force -TimeOut 120
# DNSNAME,IP,MASK,GW
# server.example.com,10.10.10.10,255.255.255.0,10.10.10.20
$ilos = import-csv "C:\temp\newilo.csv"
$cred = Get-Credential -UserName Administrator -Message "Enter iLO password"
ForEach ($item in $ilos)
{
$DNSNAME = $item.DNSNAME
$IP = $item.IP
$MASK = $item.MASK
$GW = $item.GW
Write-Host "Setting network on $DNSNAME"
Set-HPiLONetworkSetting -Credential $cred -Server $DNSNAME -GatewayIP $GW -IPAddress $IP -SubnetMask $MASK -DisableCertificateAuthentication -Debug -Verbose
Write-Host 'Pausing for 35 seconds for iLO reset with new IP'
Reset-HPiLORIB -Credential $cred -Server $DNSNAME
Start-Sleep -s 35
if ((Test-NetConnection -Port 22 -ComputerName $IP -InformationLevel Quiet) -eq $true)
{
write-host "server $IP online "
}
else
{
write-host "!!!!!!!!!!!! SERVER $IP NOT ONLINE!!!!!!!!!!!!!!"
}
}