Score:0

Why are "wmic diskdrive get size" and "(Get-Disk).Size" returning slightly different values?

th flag

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
JosefZ avatar
th flag
`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…
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.