PowerShell Dell Open Manage

  • Welcome to ITBible, we're your #1 resource for enterprise or homelab IT problems (or just a place to show off your stuff).
The base for each of these snippets were written over at CyberDrain and I've modified them for running other commands / providing the output that we need.

Battery Status​

This will return an error if something is wrong otherwise it will return "Healthy."
PowerShell:
$cmd = (&"C:\Program Files\Dell\SysMgt\oma\bin\omreport.exe" storage battery).Trim()
$cmd1 = ($cmd -split "`n").Trim()

foreach($c in $cmd1)
{
    $split = ($c -split ":").Trim()
    if($split[0] -eq "Status")
    {
        Write-Host $split[1]
    }
}

Version​

This will return the RAID version (this checks the version of StorCLI).
PowerShell:
$cmd = (&"C:\Program Files\Dell\SysMgt\oma\bin\omreport.exe" storage controller).Trim()
$cmd1 = ($cmd -split "`n").Trim()

foreach($c in $cmd1)
{
    $split = ($c -split ":").Trim()
    if($split[0] -eq "Driver Version")
    {
        Write-Host $split[1]
    }
}


Physical Drive Status​

This will return an error if there is an issue with any physical drives and will return "Healthy" otherwise.
PowerShell:
$cmd = (&"C:\Program Files\Dell\SysMgt\oma\bin\omreport.exe" storage pdisk controller=0).Trim()
$cmd1 = ($cmd -split "`n").Trim()

foreach($c in $cmd1)
{
    Write-Host $c
}

# Ref CyberDrain
try {
    omconfig preferences cdvformat delimiter=comma
    $OmReport = omreport storage pdisk controller=0 -fmt cdv | select-string -SimpleMatch "ID,Status" -Context 0,5000
} catch {
    $ScriptError = "omreport Command has Failed: $($_.Exception.Message)"
    exit
}

$Parray = convertfrom-csv $OmReport -Delimiter ","

foreach($PhysicalDisk in $Parray){
    if($($PhysicalDisk.State) -ne "Online" -or $($PhysicalDisk.Status) -ne "Ok") {
        $DiskStatus += "$($PhysicalDisk.Name) / $($PhysicalDisk.'Serial No.') Has Status $($PhysicalDisk.Status) / $($PhysicalDisk.State)`n"
    }

    if($($PhysicalDisk.'Failure Predicted') -eq "Yes"){
        $DiskStatus += "$($PhysicalDisk.Name) / $($PhysicalDisk.'Serial No.') Has a predicted failure error `n"
    }
}

if(!$DiskStatus){ $DiskStatus = "Healthy"}
if(!$ScriptError){ $ScriptError = "Healthy"}

Virtual Drive Status​

This will return an error if there is an issue with any virtual drives and will return "Healthy" otherwise.
PowerShell:
$cmd = (&"C:\Program Files\Dell\SysMgt\oma\bin\omreport.exe" storage vdisk controller=0).Trim()
$cmd1 = ($cmd -split "`n").Trim()

foreach($c in $cmd1)
{
    Write-Host $c
}

# Ref CyberDrain
try {
    omconfig preferences cdvformat delimiter=comma
    $OmReport = omreport storage vdisk -fmt cdv |  select-string -SimpleMatch "ID,Status," -Context 0,5000
}catch{
    $ScriptError = "omreport Command has Failed: $($_.Exception.Message)"
    exit
}

$VDarray = convertfrom-csv $OmReport -Delimiter ","

foreach($VirtualDisk in $VDarray){
    if($($virtualdisk.State) -eq "Ready" -or $($virtualdisk.Status) -eq "Ok"){
    }else{
        $RAIDStatus = "$($VirtualDisk.Name) / $($VirtualDisk.'Device Name') Has Status $($VirtualDisk.Status) / $($VirtualDisk.State)"
    }
}

if(!$RAIDStatus){ $RAIDStatus = "Healthy"}
if(!$ScriptError){ $ScriptError = "Healthy"}