0

As you can see, the following commands provide slightly different output. Why? I was expecting them to be the same. There is a 2.66MB difference between the two.

How can I get the values from "wmic diskdrive get size" in powershell? This is the value I'm needing and it's the one that appears in the MSINFO32 tool.

  • wmic diskdrive get size
  • (Get-Disk).Size
  • (Get-PhysicalDisk).Size
PS C:\Windows\system32> wmic diskdrive get size
Size          

858990666240  
103079208960  

PS C:\Windows\system32> (Get-Disk).Size
858993459200
103079215104

PS C:\Windows\system32> (Get-PhysicalDisk).Size
858993459200
103079215104
Ingram
  • 153
  • 1
  • 2
  • 7
  • `wmic diskdrive get size` is _unformatted_ capacity, see `Get-CimInstance Win32_DiskDrive | Select-Object -Property SerialNumber, Size, @{ name='CountSize'; expr={$_.TotalCylinders * $_.TracksPerCylinder * $_.SectorsPerTrack * $_.BytesPerSector} }`. Check `Get-Disk|select UniqueID,AllocatedSize,Size` and `Get-Partition|select UniqueId, Offset, Size` as well… BTW, this _2.66MB difference_ is roughly `0.000325` percent… – JosefZ Jun 06 '23 at 19:53

0 Answers0