See physical drives on windows PC (powershell)
Created: =dateformat(this.file.ctime,"dd MMM yyyy, hh:mm a") | Modified: =dateformat(this.file.mtime,"dd MMM yyyy, hh:mm a")
Tags: knowledge
See physical drives SSD / HDD on windows PC
Get-PhysicalDisk | ForEach-Object {
$physicalDisk = $_
$partitions = Get-WmiObject Win32_DiskPartition | Where-Object { $_.DiskIndex -eq $physicalDisk.DeviceID }
$logicalDrives = $partitions | ForEach-Object {
Get-WmiObject Win32_LogicalDiskToPartition | Where-Object { $_.Antecedent -match $partitions.DeviceID } |
ForEach-Object {
($_ | Select-Object -ExpandProperty Dependent) -replace '^.*="(.*)".*$', '$1'
}
}
[PSCustomObject]@{
PhysicalDisk = $physicalDisk.DeviceID
MediaType = $physicalDisk.MediaType
LogicalDrives = ($logicalDrives -join ", ")
SizeGB = [math]::Round($physicalDisk.Size / 1GB, 2)
DiskModel = $physicalDisk.Model
}
} | Format-Table -AutoSizeVirtual disk
diskpart
> list vdisk
>>> VDisk ### Disk ### State Type File
>>> --------- -------- -------------------- --------- ----
>>> VDisk 0 Disk 2 Attached not open Fixed C:\Windows\DSClient\VHD\DATA.vhdx