Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Lock method of the Win32_EncryptableVolume class

The Lock method of the Win32_EncryptableVolume class dismounts the volume and removes the volume's encryption key from system memory. The contents of the volume remain inaccessible until it is unlocked by either the UnlockWithExternalKey method or the UnlockWithNumericalPassword method. This method cannot be successfully run for the currently running operating system volume.

Note  If the disc supports hardware encryption, the band is set to "locked".


uint32 Lock(
  [in, optional]  boolean ForceDismount


ForceDismount [in, optional]

Type: boolean

If true the disk is forcibly dismounted.

Return value

Type: uint32

This method returns one of the following codes or another error code if it fails.

Return code/valueDescription
0 (0x0)

The method was successful.

2147942405 (0x80070005)

Applications are accessing this volume. If all access is nonexclusive, specifying the ForceDismount parameter as true allows the method to run successfully.

2150694913 (0x80310001)

The volume is fully decrypted and cannot be locked.

2150694945 (0x80310021)

The volume's encryption key is available in the clear on the disk, preventing the volume from being locked.

2150694946 (0x80310022)

The volume does not have key protectors of the type "Numerical Password" or "External Key" that are necessary to unlock the volume.



Managed Object Format (MOF) files contain the definitions for Windows Management Instrumentation (WMI) classes. MOF files are not installed as part of the Windows SDK. They are installed on the server when you add the associated role by using the Server Manager. For more information about MOF files, see Managed Object Format (MOF).


Minimum supported client

Windows Vista Enterprise, Windows Vista Ultimate [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]





See also




Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.