Some times you want a quick report of the disk types and firmware versions with the number of disks on each version.
Recently NetApp put out a billiton about older disk firmware failing more often that they should. I was given the task of making sure all our disks where OK. To archive that I had to update a lot of disks. The process is straight forward and I may do a post about that. But once you have uploaded the necessary firmwares you may need to keep track of the progress.
So here is a quick script i made in to a function
It basically gets an array of all the disks
- gets all the disks in to an array
- creates a array of all unique disk models
- loops through the disk model array and gets firmware versions in to another array
- now loops through the firmware array getting the number of disks at that version
so you end up with something this
Disk model 100, firmware 100, disks 5
Disk model 100, firmware 101, disks 2
Disk model 103, firmware 105, disks 10
Disk model 103, firmware 106, disks 50
Using this I can quickly see what model disks are on what version of firmware. I run it after the I uploaded the firmware to track the upgrade process.
So here is the script
import-module posh-ssh
$cred = Get-Credential
$AFF = "MyFAS.lab.local"
$Connection = Connect-NcController $AFF -Cred $Cred
function Get-NCdiskFirmwares
{
    $Disks = get-ncdisk
    # get a n array of unique disk models
    $diskMods = $Disks.model | sort -Unique
    # loop through each disk model
    foreach ($diskMod in $diskMods)
    {
        # get an array of disk of the current model
        $FWversionDisks = $Disks | where{$_.model -eq $diskMod}
        # get an array of all the unique firmware versions
        $FWVersions = $FWversionDisks.FW | sort -Unique
        # loop though each firmware version
        foreach ($FWVersion in $FWVersions)
        {
            # get an array of the current model and current firmware version and count the number of disks, print it to the screen
            $NumDisks = ($Disks | where{$*.model -eq $diskMod -and $*.FW -eq $FWVersion}).count
            "disks, model " + $diskMod + " , FW  " + $FWVersion + " , number " + $NumDisks
        }
    }
}
now run the function and you will get a list of the number of disks at a specific model and firmware version.
Get-NCdiskFirmwares
disks, model X4002S172A3T8NTE , FW NA02 , number 22
disks, model X4002S172A3T8NTE , FW NA03 , number 14
disks, model X4011S172B3T8NTE , FW NA54 , number 24
disks, model X4011S17333T8NTE , FW NA50 , number 47
disks, model X4011S17333T8NTE , FW NA51 , number 15
disks, model X4016S172B3T8NTE , FW NA54 , number 12
