How to identify the disk Optane or Raid type using Powershell?

406 Views Asked by At

I would like to identify the disk information whether it contain of RAID or Optane. Is it possible to get that information with PowerShell? I try Get-PhysiclDisk and Get-Disk, but not including that information.

Any advice, really appreciated! Thank you

1

There are 1 best solutions below

0
Ranadip Dutta On

There is a simple script written by Christopher Klein:

$dp = "list volume" | diskpart | ? { $_ -match "^  [^-]" }

echo `<`<`<local`>`>`>
foreach ($row in $dp) {
    # skip first line
    if (!$row.Contains("Volume ###")) {
        # best match RegExp from http://www.eventlogblog.com/blog/2012/02/how-to-make-the-windows-softwa.html
        if ($row -match "\s\s(Volume\s\d)\s+([A-Z])\s+(.*)\s\s(NTFS|FAT)\s+(Mirror|RAID-5|Stripe|Spiegel|Spiegelung|Übergreifend|Spanned)\s+(\d+)\s+(..)\s\s([A-Za-z]*\s?[A-Za-z]*)(\s\s)*.*")  {
            $disk = $matches[2] 
            # 0 = OK, 1 = WARNING, 2 = CRITICAL
            $statusCode = 1
            $status = "WARNING"
            $text = "Could not parse line: $row"
            $line = $row

            if ($line -match "Fehlerfre |OK|Healthy") {
                $statusText = "is healthy"
                $statusCode = 0
                $status = "OK"
            }
            elseif ($line -match "Rebuild") {
                $statusText = "is rebuilding"
                $statusCode = 1
            }
            elseif ($line -match "Failed|At Risk|Fehlerhaf") {
                $statusText = "failed"
                $statusCode = 2
                $status = "CRITICAL"
            }

            echo "$statusCode microsoft_software_raid - $status - Software RAID on disk ${disk}:\ $statusText"
        }
    }
}

NOTE: diskpart requires administrative privileges so this script must be executed under an administrative account if it is executed standalone.

Hope it helps.