The sample code below establishes the constants, sets the Windows Disk Protection level to the Retain Changes Temporarily option (WDP_MODE_PERSIST), and then specifies the date and time at which this mode will expire and revert to the Remove All Changes at Restart option (WDP_MODE_DISCARD).

' Windows Disk Protection sample script

' Define some useful constants
'
' WDP_Control.CurrentStatus
const WDP_ACTIVE  = 0
const WDP_PASSIVE = 1

' WDP_Control.CurrentMode
const WDP_MODE_DISCARD = 0
const WDP_MODE_PERSIST = 1
const WDP_MODE_COMMIT  = 2

' Identify the computer to manipulate
'

strComputer  = "."

' The WDP_Control.PersistDateTime property requires a FILETIME type.  
' The easiest way to create a FILETIME from readable string is to use
' the WBemScripting.SWbemDateTime object.

set dateTime = Createobject ("WBemScripting.SWbemDateTime")

' Set the datetime to May 8, 2020 at 8:00 AM
dateTime.SetVarDate #5/8/2020 08:00:00 AM#
'
' Get an instance of the WDP_Control WMI class
'

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

See Also