cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 9

Powershell script for storage controller driver version

I wants to monitor storage controller driver version.

I have created below script for the same.

$StorageDriverVersion = ((Get-WmiObject Win32_PnPSignedDriver| select DeviceName, DriverVersion | Where {$_.DriverVersion -like"*6.600.21.8*"}).StorageDriverVersion)

write-host "Statistic: $StorageDriverVersion"

But I have an output as "NaN".

Kindly suggest the better script for the same.

Labels (1)
7 Replies

This limitation of script monitoring templates has been very frustrating for me, too. This component will only accept a number as valid statistic output. I'm not aware of a way to poll for multivalue results, but one option that you do have is to:

1. Check for a true/false comparison (is it the right version or not) and return a 0 or 1 as a result for the statistic.

2. Use the statistic message value to somehow present more detailed information. (Again, though, using this information in an alert is challenging unless there's a way that I don't know about.

I modified the script as below.

$StorageDriver = Get-WmiObject Win32_PnPSignedDriver| select DeviceName, DriverVersion | Where {$_.DriverVersion -like"*6.600.21.8*"} ${IP} -Credential ${CREDENTIAL}

write-host "Message.Source: $StorageDriver"

Exit(0);

And now the output is

Message.Source:

Errors: ==============================================

Where-Object : A positional parameter cannot be found that accepts argument 'xx.xx0.20.183'.

At line:1 char:90

+ ... erVersion | Where {$_.DriverVersion -like"*6.600.21.8*"} xx.xx0.20.18 ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (:) [Where-Object], ParameterBindingException

+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.WhereObjectCommand

0 Kudos

A few things for your script.

sandipc  wrote:

$StorageDriver = Get-WmiObject Win32_PnPSignedDriver| select DeviceName, DriverVersion | Where {$_.DriverVersion -like"*6.600.21.8*"} ${IP} -Credential ${CREDENTIAL}

write-host "Message.Source: $StorageDriver"

Exit(0);

The target IP address and credential are required parameters for the Get-WmiObject cmdlet, so they need to be in that part of the pipeline:

Get-WmiObject Win32_PnPSignedDriver -ComputerName ${IP} -Credential ${CREDENTIAL}

It also looks like you have a space missing after the -like operator in the Where-Object clause. It would become:

Where {$_.DriverVersion -like "*6.600.21.8*"}

and the updated script would be:

$StorageDriver = Get-WmiObject Win32_PnPSignedDriver -ComputerName ${IP} -Credential ${CREDENTIAL} | Select DeviceName, DriverVersion | Where {$_.DriverVersion -like "*6.600.21.8*"}

Write-Host "Message.Source: $StorageDriver"

Exit(0);

Now, this script will work, but you might find that you need to actually specify the name of the driver that you want to check the version of. Here's an example to give you an idea of what that would look like:

$StorageDriver = Get-WmiObject Win32_PnPSignedDriver -ComputerName ${IP} -Credential ${CREDENTIAL} | Select DeviceName, DriverVersion | Where {$_.DriverVersion -like "*6.600.21.8*" -and $_.DeviceName -like "*storage*"}

Write-Host "Message.Source: $StorageDriver"

Exit(0);


Hope this helps!

I tried this script which has error as

Output: ==============================================

Message.Source:

Errors: ==============================================

Get-WmiObject : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

At line:1 char:18

+ ... ageDriver = Get-WmiObject Win32_PnPSignedDriver -ComputerName xx.xxx. ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException

+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

I ran the script on server and expected output is as below.

DeviceName                  DriverVersion

----------                  -------------

LSI MegaRAID Virtual Device 6.600.21.8

PERC H700 Integrated        6.600.21.8

0 Kudos

Progress! RPC server unavailable most likely means that there is a network or Windows firewall rule blocking your polling engine from running this script remotely. Some options:

On the managed server, run "winrm quickconfig" to enable remote management, which will also enable the required firewall rule[s].

Check with your network/security team[s] to find out if there is a network firewall blocking RPC ports between your Orion server and your remote server. WinRM requires port 5985 (and/or 5986), and you may also need the ephemeral RPC port range opened up (I don't recall off the top of my head).

There is also a tool that Solarwinds provides that can do a lot of this work for you...I'll need to dig around to find the location of that one. Start with this, though, and let us know what you get!

sturdyerde  wrote:

This limitation of script monitoring templates has been very frustrating for me, too. This component will only accept a number as valid statistic output. I'm not aware of a way to poll for multivalue results, but one option that you do have is to:

1. Check for a true/false comparison (is it the right version or not) and return a 0 or 1 as a result for the statistic.

2. Use the statistic message value to somehow present more detailed information. (Again, though, using this information in an alert is challenging unless there's a way that I don't know about.

Sam is of course right about this script having support for numeric values.

I'm curious, what would you do with the output of the script with the version number? just display the current value? Want to track it over time? Alert on it?

0 Kudos

serena  wrote:

I'm curious, what would you do with the output of the script with the version number? just display the current value? Want to track it over time? Alert on it?

In this type of example, we would display the current value and also be able to send the current/target version in an alert.