Description of the API for the Windows Disk Protection feature in Windows SteadyState

This article has been archived. It is offered "as is" and will no longer be updated.
This article describes the API for the Windows Disk Protection feature in Windows SteadyState.

Note Windows SteadyState was formerly known as Microsoft Shared Computer Toolkit for Windows XP.

Whether you manage computers in a school computer lab or in an Internet café, in a library, or even in your home, Windows SteadyState can help make it easy for you to keep the computers running the way that you want them to, regardless of who uses them. Windows SteadyState is offered at no charge to all Windows Genuine Advantage customers who are running Windows XP. For more information about Windows SteadyState, visit the following Microsoft Web site: Note Currently, this tool is only supported for use with Windows XP.

Windows SteadyState includes a feature that is called Windows Disk Protection. Windows Disk Protection saves or clears all changes to the operating system partition at the disk protection level that you set. Windows SteadyState uses a Windows Management Instrumentation (WMI) data provider, also known as an API. The API lets a member of the Administrators group query whether Windows Disk Protection has been turned on. If Windows Disk Protection is turned on, you can use the API to modify the specific disk protection level for changes that are made to the hard disk.
More information
The WMI interface for Windows Disk Protection has the following three properties:
  • CurrentStatus
  • CurrentMode
  • PersistDateTime

The CurrentStatus property

The CurrentStatus property is a read-only property. When you query this property, it returns a value that indicates whether Windows Disk Protection is active or is passive. There are two possible values:
  • WDP_ACTIVE (0)
Windows Disk Protection is in an active state (WDP_ACTIVE) if it is actively caching changes. Windows Disk Protection is in a passive state (WDP_PASSIVE) if changes can be saved directly to the hard disk without using the cache file as temporary storage when Windows Disk Protection is turned on.

Note The passive state (WDP_PASSIVE) is not a user-selectable state or a writable state that is available by using the Windows SteadyState user interface. Instead, this state is used internally by Windows SteadyState. Under typical circumstances, the value of this property will be WDP_ACTIVE.

The CurrentMode property

By using the CurrentMode property, you can set or retrieve the current mode for Windows Disk Protection. The CurrentMode property can only be applied if the CurrentStatus property is WDP_ACTIVE. The following table describes the values that are available for the CurrentMode property. These values correspond directly to the three levels of disk protection that are available when Windows Disk Protection is turned on.
Windows Disk Protection modeLevel of disk protection
WDP_MODE_DISCARD (0)Remove All Changes at Restart
WDP_MODE_PERSIST (1)Retain Changes Temporarily
WDP_MODE_COMMIT (2)Retain All Changes Permanently

The PersistDateTime property

By using the PersistDateTime property, you can query or specify the date and the time at which WDP_MODE_PERSIST expires. If Windows Disk Protection is turned on, Windows Disk Protection automatically reverts to WDP_MODE_DISCARD when WDP_MODE_PERSIST expires. When you query the PersistDateTime property, the data type for the PersistDateTime property is WBemScripting.SWbemDateTime.

Note The PersistDateTime property has no effect unless the CurrentMode property is set to WDP_MODE_PERSIST.

The following example code sets the Windows Disk Protection level to the Retain Changes Temporarily option (WDP_MODE_PERSIST). Also, this code specifies the date and the time that this mode expires and reverts to the Remove All Changes at Restart option (WDP_MODE_DISCARD).

Example code

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
set dateTime = CreateObject ("WBemScripting.SWbemDateTime")' Set the dateTime to May 8, 2020 at 8:00 AMdateTime.SetVarDate #5/8/2020 08:00:00 AM#' Identify the computer to managestrComputer= "."       set objWbemServices = GetObject ("winmgmts:\\" & strComputer & "\root\wmi")set setWdpObjects   = objWbemServices.ExecQuery ("SELECT * FROM WDP_Control")for each objWdp in setWdpObjects   objWdp.CurrentMode  = WDP_MODE_PERSIST   objWdp.PersistDateTime = dateTime.GetFileTime   objWdp.Put_next

Article ID: 938335 - Last Review: 01/16/2015 09:40:36 - Revision: 2.0

Microsoft Win32 Application Programming Interface

  • kbnosurvey kbarchive kbhowto kbexpertiseadvanced kbinfo KB938335