StorageManager.Disks Property
Gets a collection that contains all of the disks on the system.
Namespace: Microsoft.WindowsServerSolutions.Storage
Assembly: StorageOM (in StorageOM.dll)
Syntax
public ThreadSafeReadOnlyObservableCollection<Disk> Disks { get; }
public:
property ThreadSafeReadOnlyObservableCollection<Disk^>^ Disks {
ThreadSafeReadOnlyObservableCollection<Disk^>^ get();
}
Public ReadOnly Property Disks As ThreadSafeReadOnlyObservableCollection(Of Disk)
Property Value
Type: Microsoft.WindowsServerSolutions.Common.ProviderFramework.ThreadSafeReadOnlyObservableCollection<Disk>
A ThreadSafeReadOnlyObservableCollection<T> that contains all of the disks on the system.
Remarks
Care must be used when the code calls synchronous storage operations from a storage collection changed event handler. The thread that the object model uses to call the event handler will deadlock if a synchronous storage operation is invoked. A different thread, or an approach that uses asynchronous operations, should be used.
Examples
The following code example shows how to display information about all of the disks in storage.
try
{
StorageManager storageManager = new StorageManager();
storageManager.Connect();
}
catch (StorageObjectModelException stoEx)
{
//Handle exception
}
foreach (Disk disk in storageManager.Disks)
{
Console.WriteLine("Disk {0}:", disk.FriendlyName);
Console.WriteLine("---------------------------");
Console.WriteLine("BusType = {0}", disk.BusType);
Console.WriteLine("CapacityBytes = {0}", disk.CapacityBytes);
Console.WriteLine("CurrentStatus = {0}", disk.CurrentStatus);
Console.WriteLine("DiskSetID = {0}", disk.DiskSetID);
Console.WriteLine("DataFreeBytes = {0}", disk.DataFreeBytes);
Console.WriteLine("ID = {0}", disk.ID);
Console.WriteLine("ManufacturerName = {0}", disk.ManufacturerName);
Console.WriteLine("Partition = {0}", disk.Partition);
Console.WriteLine("SerialNumber = {0}", disk.SerialNumber);
Console.WriteLine("SystemDisk {0}", disk.SystemDisk);
Console.WriteLine("BackupDisk {0}", disk.BackupDisk);
Console.WriteLine("DataCapacityBytes = {0}", disk.DataCapacityBytes);
Console.WriteLine("UserTag = {0}", disk.UserTag);
Console.WriteLine("VdsID = {0}", disk.VdsID);
Console.WriteLine();
}
See Also
StorageManager Class
Microsoft.WindowsServerSolutions.Storage Namespace
Return to top