Disable Method (Standard 7 SP1)
7/8/2014
The Disable method disables an enabled overlay for the specified protected volume.
This topic uses Managed Object Format (MOF) syntax.
Syntax
uint32 Disable(
[in] boolean Commit
);
Parameters
- Commit [in]
If set to true, the current overlay is committed before the protection is disabled; otherwise, all overlays are discarded and protection is disabled.
Return Value
An HRESULT that indicates WMI status, a WMI error, or an error from the EWF and FBWF API libraries.
Example
This example can be used to disable the overlay on a protected volume without committing any data in the overlay.
Windows PowerShell
$ComputerName = "localhost" # or "remote-machine-name"
$Namespace = "root\Microsoft\WriteFilters"
$EwfVolumeClass = "EwfVolume"
$EwfVolumeName = "\\Device\\HarddiskVolume1"
$EwfVolume = Get-WmiObject `
-ComputerName $ComputerName `
-Namespace $Namespace `
-Class $EwfVolumeClass `
–Filter "Name='$EwfVolumeName'"
$Result = $EwfVolume.Disable($False)
$ReturnValue = "0x{0:x}" -f $Result.ReturnValue
Write-Host "Method executed with return code: " $ReturnValue
VBScript
strComputer = "localhost" ' or "remote-machine-name"
strNamespace = "\root\Microsoft\WriteFilters"
strClass = "EwfVolume"
strVolumeName = "\Device\HarddiskVolume1"
On Error Resume Next
Set EwfVolumes = GetObject("WINMGMTS:\\" & strComputer & _
strNamespace).InstancesOf(strClass)
For Each EwfVolume In EwfVolumes
If EwfVolume.Name = strVolumeName Then
Err = EwfVolume.Disable(False)
If Err.number <> 0 Then
WScript.Echo "Method exited with error code: 0x" & Hex(Err.number)
WScript.Echo Err.source & " - " & Err.Description
WScript.Quit(1)
Else
WScript.Echo strVolumeName, "protection will be disabled after next reboot"
End If
End If
Next
Requirements
Supported clients |
Windows XP Embedded SP3 |
MOF |
EWFProvider.mof |
Namespace |
\root\Microsoft\WriteFilters |