Hey Y'all,

I ran across an interesting anomaly today while working on my PC Information PS Utility.

I was using this code:
Code:
 $PhyDiskInfo = `
          Get-WMIObject -Computer $compname -Class Win32_diskdrive |
          Where-Object {$_.size -ge 0 } | Sort-Object -Property Name

  $SSD = 0
  ForEach ($x in $phydiskinfo) { if ($x.model -match 'SSD') { $SSD+=1} }

  If ($SSD -gt 0) {

      $TrimVal = $(fsutil behavior query disabledeletenotify).Split('=')
                  
#--- PS IIF construct! ---
      $TrimStatus = (&{If([int]$TrimVal[1] -eq 0) {"Trim is Enabled"}
                     Else {"Trim is Disabled....Fix THIS!"}})
      $TrimStatus = 
@"
[ ---> $TrimStatus <--- ]

"@ | Out-String

  }  #End If ($SSD...

  $DNLen = Get-MaxLength -TestObj $PhyDiskInfo.Caption      -MinLen 4
  $SNLen = Get-MaxLength -TestObj $PhyDiskInfo.SerialNumber -MinLen 13

  $fmtPhyDisk = @{Expression={$_.Name.trim('\\.\PHYSICALDRIVE')};
                  Label="Drv`n No";Width=3;Align='Right'},
                @{Expression={$_.Caption};Label="`nName";Width=$DNLen},
                @{Expression={$_.Model -Match 'SSD'};Label="`nSSD";
                                             Width=5;Align='left'},
                @{Expression={$_.SerialNumber.Trim()};
                      Label="`nSerial Number";Width=$SNLen;Align='left'},
                @{Expression={ '{0:#,000.00}' -f ($_.Size/1gb)};
                      Label="Disk Size`n / GB";Width=9;align='right'},
                @{Expression={$_.Partitions};Label="`n#Parts";Width=6}

  $PhyDiskInfo | Format-Table -Property $fmtPhyDisk
Which produced this result:
Code:
Drv                                              Disk Size       
 No Name                   SSD   Serial Number        / GB #Parts
--- -----                  ----  --------------  --------- ------
  0 SanDisk SDSSDXPS240G   True  143175400294       223.57      7
  1 WDC WD5000HHTZ-04N21V1 False WD-WXT1E64KPWLM    465.76      2
  2 ST1000DM003-1CH162     False S1DBLJNM           931.51      1
Notice the item in Blue and how the partition count would seem to be confirmed by Windows Disk Management below.
DiskManagement.PNG

I was looking to get some more information on the disks and I ran across the Get-Disk cmdlet so I thought I'd use it with this code:
Code:
   $PhyDiskInfo = Get-Disk  |
          Where-Object {$_.size -gt 0 } | Sort-Object -Property DiskNumber
 
  $SSD = 0
  ForEach ($x in $phydiskinfo) { if ($x.model -match 'SSD') { $SSD+=1} }

  If ($SSD -gt 0) {

      $TrimVal = $(fsutil behavior query disabledeletenotify).Split('=')
                  
#--- PS IIF construct! ---
      $TrimStatus = (&{If([int]$TrimVal[1] -eq 0) {"Trim is Enabled"}
                     Else {"Trim is Disabled....Fix THIS!"}})
      $TrimStatus = 
@"
[ ---> $TrimStatus <--- ]

"@ | Out-String

  }  #End If ($SSD...

  $DNLen = Get-MaxLength -TestObj $PhyDiskInfo.Model        -MinLen 4
  $SNLen = Get-MaxLength -TestObj $PhyDiskInfo.SerialNumber -MinLen 13

  $fmtPhyDisk = 
     @{Expression={$_.DiskNumber};Label="Drive`n No.";Width=5;
                                  Align='Center'},
     @{Expression={$_.Model};Label="`nName";Width=$DNLen},
     @{Expression={$_.Model -Match 'SSD'};Label="`nSSD";
                                          Width=5;Align='left'},
     @{Expression={ '{0:#,000.00}' -f ($_.Size/1gb)};
                      Label="Disk Size`n / GB";Width=9;align='right'},
     @{Expression={$_.NumberOfPartitions};Label="Parti`ntions";Width=5},
     @{Expression={$_.PartitionStyle};Label="GPT`nMBR";Width=3},
     @{Expression={$_.IsBoot};Label="`nBoot";Width=5;Align="Left"},
     @{Expression={$_.BusType};Label="Data`nBus";Width=4}

  
  $PhyDiskInfo | Format-Table -Property $fmtPhyDisk
Providing this information:
Code:
Drive                              Disk Size Parti GPT       Data
 No.  Name                   SSD        / GB tions MBR Boot  Bus 
----- -----                  ----  --------- ----- --- ----- ----
  0   SanDisk SDSSDXPS240G   True     223.57     8 GPT True  SATA
  1   WDC WD5000HHTZ-04N21V1 False    465.76     2 GPT False SATA
  2   ST1000DM003-1CH162     False    931.51     1 GPT False SATA
Woo Hoo! I just got an extra partition on my SSD! WTF?

So I thought I'd try a different tool for confirmation ... Partition-Wizard Mini-Tool:
Mini-Tool.PNG

Look at that an extra 128Mb of space hiding from Windows own tools (Disk Management and WMI)! Go figure.

I just thought you Loungers might be interested.

HTH