Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here you go, using C# and WMI. Using this you can type in "enumSANDrives " from a command prompt and it will list them out. You might have to tweak the descriptions a little and manually look at the WMI class through Scriptomatic or something to match up your particular SAN(s).</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; using System.Management; using System.Data.SqlClient; using Microsoft.Win32; using System.Net; using System.Net.NetworkInformation; using System.Runtime.InteropServices; using System.Security.Permissions; using System.Security.Principal; namespace EnumSANDrives { class Program { static void Main(string[] args) { //1. Start with the Win32_DiskDrive class and query for instances of Win32_DiskPartition using the DeviceID property and the //Win32_DiskDriveToDiskPartition association class. Now you have a collection of the partitions on the physical drive. //2. Query for the Win32_LogicalDisk that represents the partition using the Win32_DiskPartition.DeviceID property and //Win32_LogicalDiskToPartition association class. //3. Get the drive letter from the Win32_LogicalDisk.DeviceID. ConnectionOptions connOptions = new ConnectionOptions(); connOptions.Username = "&lt;username&gt;"; connOptions.Password = "&lt;pwd&gt;"; connOptions.Authentication = AuthenticationLevel.Packet; connOptions.Impersonation = ImpersonationLevel.Impersonate; connOptions.EnablePrivileges = true; ManagementScope manScope = new ManagementScope(String.Format(@"\\{0}\ROOT\CIMV2", machine), connOptions); manScope.Connect(); ObjectQuery oQueryDiskDrive = new ObjectQuery("select * from Win32_DiskDrive"); ManagementObjectSearcher oSearcherDiskDrive = new ManagementObjectSearcher(manScope, oQueryDiskDrive); ManagementObjectCollection oReturnDiskDrive = oSearcherDiskDrive.Get(); foreach (ManagementObject DiskDrive in oReturnDiskDrive) { ObjectQuery oQueryDiskPartition = new ObjectQuery("ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" + DiskDrive["DeviceID"] + "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition"); ManagementObjectSearcher oSearcherDiskPartition = new ManagementObjectSearcher(manScope, oQueryDiskPartition); ManagementObjectCollection oReturnDiskPartition = oSearcherDiskPartition.Get(); foreach (ManagementObject DiskPartition in oReturnDiskPartition) { ObjectQuery oQueryLogicalDisk = new ObjectQuery("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" + DiskPartition["DeviceID"] + "'} WHERE AssocClass = Win32_LogicalDiskToPartition"); ManagementObjectSearcher oSearcherLogicalDisk = new ManagementObjectSearcher(manScope, oQueryLogicalDisk); ManagementObjectCollection oReturnLogicalDisk = oSearcherLogicalDisk.Get(); foreach (ManagementObject LogicalDisk in oReturnLogicalDisk) { try { //Console.Write("Drive Name : " + LogicalDisk["DeviceID"].ToString()); if (DiskDrive["PNPDeviceID"] != null) { if (DiskDrive["PNPDeviceID"].ToString().Contains("VEN_EMC")) { Console.WriteLine("Drive Name : " + LogicalDisk["DeviceID"].ToString() + " - " + "EMC SAN " + DiskDrive["Model"].ToString()); } if (DiskDrive["PNPDeviceID"].ToString().Contains("VEN_IBM")) { Console.WriteLine("Drive Name : " + LogicalDisk["DeviceID"].ToString() + " - " + "IBM SAN " + DiskDrive["Model"].ToString()); } if (DiskDrive["PNPDeviceID"].ToString().Contains("VEN_COMPAQ")) { Console.WriteLine("Drive Name : " + LogicalDisk["DeviceID"].ToString() + " - " + "HP SAN " + DiskDrive["Model"].ToString()); } } //Console.WriteLine("Size : " + BytesToGB(DiskDrive["Size"].ToString())); //Console.WriteLine("Used Space : " + BytesToGB((Convert.ToDouble(DiskDrive["Size"].ToString()) - Convert.ToDouble(LogicalDisk["FreeSpace"].ToString())).ToString())); //Console.WriteLine("Free Space : " + BytesToGB(LogicalDisk["FreeSpace"].ToString())); } catch (Exception) { continue; } } } } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload