Disk information script
This chapter explains different methodologies for scanning the different aspects of the logical drives attached to your system. If you want to query the disks on a system, convert the disk size and free space, and identify the drive types, you can create the following script:
function measure-diskunit { param($diskspace) switch ($diskspace) { {$_ -gt 1PB} { return [System.Math]::Round(($_ / 1PB),2),"PB" } {$_ -gt 1TB} { return [System.Math]::Round(($_ / 1TB),2),"TB" } {$_ -gt 1GB} { return [System.Math]::Round(($_ / 1GB),2),"GB" } {$_ -gt 1MB} { return [System.Math]::Round(($_ / 1MB),2),"MB" } {$_ -gt 1KB} { return [System.Math]::Round(($_ / 1KB),2),"KB" } default { return [System.Math]::Round(($_ / 1MB),2),"MB" } } } $disks = get-wmiobject win32_logicaldisk Foreach ($disk in $disks) { $driveletter = $disk.DeviceID $freespace = $disk.FreeSpace $size = $disk.Size if ($freespace -lt 1) { $freespace = "0"...