Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sends the request for check disk to be run and waits for the operation to finish.
Namespace: Microsoft.WindowsServerSolutions.Storage
Assembly: StorageOM (in StorageOM.dll)
Syntax
public void CheckDisk()
public:
void CheckDisk()
Public Sub CheckDisk
Examples
The following code example shows how to request the check disk operation to be run:
try
{
StorageManager storageManager = new StorageManager();
storageManager.Connect();
}
catch (StorageObjectModelException stoEx)
{
//Handle exception
}
DiskSet diskSet = storageManager.DefaultDiskSet;
Boolean scanOnly = true;
if (diskSet == null)
{
Console.WriteLine("A default diskSet was not found");
}
else
{
Volume volumeToCheck = diskSet.Volumes.FirstOrDefault();
if (volumeToCheck == null)
{
Console.WriteLine("Volume was not found");
}
else
{
CheckDiskRequest checkDiskRequest =
volumeToCheck.GetCheckDiskRequest(scanOnly);
try
{
checkDiskRequest.CheckDisk();
Console.WriteLine("Output Log: {0}", checkDiskRequest.OutputLog);
Console.WriteLine("Operation result: {0}", checkDiskRequest.Result);
}
catch (StorageObjectModelException stoEx)
{
Console.WriteLine("Exception: {0}. Error Code: {1}",
stoEx.Message, stoEx.ErrorCode);
}
}
}
See Also
CheckDiskRequest Class
Microsoft.WindowsServerSolutions.Storage Namespace
Return to top