Partager via


InitializeStorageRequest.InitializeStorage Method ()

 

Sends the request to initialize storage and waits for the process to finish.

Namespace:   Microsoft.WindowsServerSolutions.Storage
Assembly:  StorageOM (in StorageOM.dll)

Syntax

public void InitializeStorage()
public:
void InitializeStorage()
Public Sub InitializeStorage

Examples

The following code example shows how to request to initialize storage:

try
{
   StorageManager storageManager = new StorageManager();
   storageManager.Connect();
}
catch (StorageObjectModelException stoEx)
{
   //Handle exception
}

Disk disk = storageManager.Disks.FirstOrDefault();
if (disk == null)
{
   Console.WriteLine("The disk was not found");
}
else
{
   string DISK_NAME = "IC disk";
   InitializeStorageRequest initializeStorageRequest = 
      storageManager.GetInitializeStorageRequest(false, disk.ID, DISK_NAME);
   try
   {
      initializeStorageRequest.InitializeStorage();
   }
   catch (StorageObjectModelException stoEx)
   {
      Console.WriteLine("Exception: {0}. Error Code: {1}", 
         stoEx.Message, stoEx.ErrorCode);
   }
}

See Also

StorageManager
Disk
InitializeStorageRequest Class
Microsoft.WindowsServerSolutions.Storage Namespace

Return to top