List total no of Physical disk(with RAID) & size of each HDD

by Nidhin CK at 2013-01-17 11:25:19

Hi Experts -

I just need to pull the total no of HDD details of a server (Win 2k8 R2) and size of each HDD
I used below wmi command but this command is not giving me the exact details.

get-wmiobject -class "Win32_DiskDrive" -namespace "root\CIMV2"

For eg:- I have executed this command on a server which has 5 Physical HDD with 72GB each. and we have also configured RAID for these HDD
1) RAID 1 (2 hdd) = 72GB
2) RAID 1 (2 hdd) = 72GB
3) one Hot Swap HDD = 72GB

when i executed the above command i’m just getting 2HDD information. May be it is pulling only two RAID1 information.
Is there any other way to find the total no of HDD present in a machine.
by ArtB0514 at 2013-01-17 11:39:37
What exactly do you mean by "no luck"? It works just fine for me.
$Disks = @(Get-WmiObject Win32_DiskDrive)
"Found $($Disks.Count) physical disks."
If ($Disks.Count -ge 1) {
$Disks | Format-Table DeviceID,Partitions,Model,@{Name='Size';Expression={"{0:N1} GB" -f ($_.Size/1GB)}} -AutoSize
}


Found 1 physical disks.

DeviceID Partitions Model Size
-------- ---------- ----- ----
\.\PHYSICALDRIVE0 1 HITACHI HTS543232L9SA00 ATA Device 298.1 GB
by Nidhin CK at 2013-01-17 11:55:52
did you try this command in any server with more than one physical hdd with RAID configured on those HDD?
I have executed this command in one of the machine which has 5 HDD (RAID 1 (2 HDD), RAID (2HDD) & one Hotswap) but the result shows only two HDD. why is that ?
by RichardSiddaway at 2013-01-17 13:45:23
The problem revolves around the number of disks that Windows sees.

if you have a standard laptop with one physical disk - you will see one physical disk reported by WMI.

if your server has 5 disks and you use Windows to create the RAID arrays you will see 5 physical disks reported by WMI

if you server has 5 disks and you use the hardware to create the RAID arrays you will see each array reported as a single physical disk.

if you have hardware created arrays you can’t get back to the physical number of disks from within Windows