Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,228 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
Is it possible to know if the disk has RAID configuration or not. If RAID is configured, the information of the RAID volumes using VB.Net or PowerShell?
This is what I have checked so far, but not desired results:
Get-PhysicalDisk
Get-Partition
Get-Volume
Dim DiskInfo As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_DiskDrive")
For Each queryDisk As ManagementObject In DiskInfo.Get()
It can be done with VDS and Storage Pool Object, but complicated, with P/Invoke
Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query.
Yes, it is possible to determine if a disk has a RAID configuration and retrieve information about the RAID volumes using VB.Net or PowerShell.
In VB.Net, you can use the WMI (Windows Management Instrumentation) classes to query the RAID configuration information. The Win32_DiskDrive and Win32_DiskDriveToDiskPartition classes can be used to retrieve information about the physical disks and partitions, respectively.
You can use the following example VB.Net code to check if a disk has a RAID configuration:
Dim searcher As New ManagementObjectSearcher("SELECT * FROM Win32_DiskDriveToDiskPartition")
For Each queryObj As ManagementObject In searcher.Get()
If queryObj("Antecedent").ToString().Contains("RAID") Then
Console.WriteLine("Disk has RAID configuration.")
Else
Console.WriteLine("Disk does not have RAID configuration.")
End If
Next
In PowerShell, you can use the Get-Disk and Get-VirtualDisk cmdlets to retrieve information about the physical disks and virtual disks, respectively.
You can use the following example PowerShell code to check if a disk has a RAID configuration:
$disks = Get-Disk
foreach ($disk in $disks) {
if ($disk.IsSystem) {
Write-Host "Disk $($disk.Number) is RAID:" $disk.IsRAID
}
}
To retrieve information about the RAID volumes, you can use the following PowerShell cmdlet:
Get-VirtualDisk
This will show you the RAID volume name, health status, size, and other information.
It's worth noting that not all RAID configurations are exposed to the operating system as RAID. Some RAID configurations are handled by the hardware controller, and in this case, the operating system doesn't see the RAID configuration.
To check if the RAID is handled by the controller you can check the RAID controller management software.
You can also check the RAID configuration settings in the BIOS or UEFI firmware settings.
If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.