-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdate-Nimble-Firmware.ps1
61 lines (54 loc) · 2.22 KB
/
Update-Nimble-Firmware.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<#
Author: Stan Crider
Date: 11-5-2019
What this crap does:
Updates Nimble to latest specified firmware version
### Must have HPENimblePowerShellToolkit module installed!!!
### Nimble uses port 5392 for API calls ###
### Must have TXT file of list of Nimble names!!!
### Must have administrative access to the Nimble interface!!!
#>
#Requires -Module HPENimblePowerShellToolkit
## User Variables
# Location of TXT file of list-of-Nimble-names
$NimbleDeviceList = Get-Content "C:\Temp\Nimble Group List.txt"
# Firmware version of Nimble OS to upgrade to
$NewVer = "5.0.8.0-677726-opt"
# Interface access
$UserName = "admin"
## Script below
# Get password for access
$Credentials = Get-Credential -Message "This script requires administrative access to the Nimble interface." -User $UserName
ForEach($NimbleDevice in $NimbleDeviceList){
If(Test-Connection $NimbleDevice -Quiet){
Write-Output "Processing $NimbleDevice..."
Connect-NSGroup -Group $NimbleDevice -Credential $Credentials -IgnoreServerCertificate
$Group = Get-NSGroup | Select-Object name,id,version_current
$VerStatus = Get-NSSoftwareVersion -fields version,status -ErrorAction SilentlyContinue
$DLV = $VerStatus | Where-Object{$_.name -eq "downloaded"}
$Installed = $VerStatus | Where-Object{$_.name -eq "installed"}
If($Installed.version -eq $NewVer){
Write-Output "$NewVer is already installed."
}
ElseIf(("downloading" -notin $VerStatus.name) -and ($DLV.version -ne $NewVer)){
Start-NSGroupSoftwareDownload -id $Group.id -version $NewVer -ErrorAction SilentlyContinue
Get-NSSoftwareVersion -ErrorAction SilentlyContinue
}
ElseIf($DLV.version -eq $NewVer){
Write-Output "$NewVer is ready to install."
$RunUpdate = (Start-NSGroupSoftwareUpdate -id $Group.id).array_response_list
If($RunUpdate.error -eq "SM_ok"){
Write-Output "$NewVer is being installed."
}
}
Else{
Write-Output "$NewVer is downloading."
}
Disconnect-NSGroup
}
Else{
Write-Warning ("$NimbleDevice is not available.")
}
# Output separater
Write-Output("_"*40)
}