Get-pDisks.psm1

<#
 
.DESCRIPTION
 Get physical disk information from Dell servers. Requires Dell OpenManage Server Manager
 
#>
 
Param()
<#
.SYNOPSIS
Gets physical SAS drive information from Dell servers
 
.DESCRIPTION
Single function to get phsical drive information from Dell servers. Returns $False if Dell OpenManage Server Manager is not found.
 
 
.Example
 
Get-PDisks
 
.INPUTS
Optional controller number (as integer)
 
.OUTPUTS
Results are returned as an array
 
.NOTES
Author: Tim Jardim
Date: 08.11.18 (dd.mm.yy)
 
Version:1.001.002
 
#>

Function Get-PDisks 
    {
      Param (
             [Int]$Controller
            )
     
     $J=0;$TmpResults=$null;$FinalResults=$null  
     If (! (Test-Path "$Env:ProgramFiles\Dell\SysMgt\oma\bin\omreport.exe") )
        {
         Return $False
        }
     $Results=CMD /C "omreport storage pdisk controller=0"
     $TmpResults=$Results | Where-Object {($_ -match "ID :") -or ($_ -match "Status" -and $_ -notmatch "Power Status")}
     For ($I=0;$I -lt ($TmpResults.Count);$I++)
         {
          $FinalResults+= $TmpResults[$I]
          $J++
          If ($J -eq 2)
               {
                $FinalResults += "`n"
                $J = 0
               }
     
          }
       Return $FinalResults
      }