locked
WDP like DiskProtect.wsf from MSCT 1.1 RRS feed

  • Question

  • Hi guys,

    I'm searching for a solution to control the Windows Disk Protection from Windows SteadyState via command line (like the WDP-Script from Microsoft Shared Computer Toolkit 1.1).

    I want set the WDP to "Save changes on next restart". This was possible in MSCT 1.1 with the script DiskProtect.wsf

    Command:
    DiskProtect.wsf /Save

    So all changes made in this sessions were saved for only one restart. After that the WDP reverts to "Remove All Changes at restart".

    I already searched for topics like this, but the WMI/VB-Scripts only save changes temporaily and specifies the data and time what this mode expires and reverts to the "Remove All Changes at Restart".
    Wednesday, September 5, 2007 11:22 AM

Answers

  • Hi Inoxx,

     

    Unfortunately, the "Save changes on next restart" option is unavailable in SteadyState. I understand that it will be a little inconvenient without this feature. Related feature request has been reported to our product team for further consideration. If this feature will be back in the new version of SteadyState, we will post the information here ASAP.

     

    Based on the current situation, we have the following two workaround:

     

    Method 1: Use the reminder feature of SteadyState

    ===================

    Actually, there is a similar feature when Windows Disk Protection (WDP) is set to “Remove all changes at restart”. If you shut down the system from an administrator account, a warning message will prompt you to choose whether to save the changes. I have include the message below:

     

    ~~~~~~~~~~~~~~~~~~

    Windows Disk Protection Is On

     

    The computer is about to restart or shut down. You must select one of the following three options in the time remaining or the computer will automatically continue and remove all changes.

     

    Time remaining: 00:30

     

    Continue and remove all changes

    -----------

    If you choose this option, you will lose all changes when the computer is restarted or shut down because Windows Disk Protection is set to Remove all changes at restart.

     

    Save changes and then continue

    -----------

    After the changes are saved, the Remove all changes at restart settings will be turned back on for the next session.

     

    Cancel and go back

    -----------

    If you choose this option, the computer will not restart or shut down.

     

               OK

    ~~~~~~~~~~~~~~~~~~

     

    You can choose “Save changes and then continue” to save changes at the restart. When the computer restarts, the “Remove all changes at restart” option will be enabled automatically.

     

     

    Method 2: Simulate this function with scripts & bat file.

    ===================

    I simulated this feature with three files: Save.bat, Commit.vbs, Discard.vbs.

     

    When you run Save.bat, the first line will add a key to the registry, it will make Discard.vbs run once on the next restart. The second line will run Commit.vbs under C:\test\

    Commit.vbs will change the WDP mode to “Retain all changes permanently”

    Discard.vbs will change the WDP mode to “Remove all changes at restart”.

     

    Thus, the total result will be: Changes will be saved on this restart. WDP will be restored to “Remove all changes at restart” after restarting the computer.

     

    Save.bat

    Code Snippet

    Reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /t REG_SZ /v WDP_s2 /d  C:\test\Discard.vbs /f

    C:\test\Commit.vbs

     

     

     

    Commit.vbs

    Code Snippet

    set dateTime = CreateObject ("WBemScripting.SWbemDateTime")

    Const WDP_MODE_COMMIT = 2

     

    ' Identify the computer to manage

    strComputer= "."

     

    set objWbemServices = GetObject ("winmgmts:\\" & strComputer & "\root\wmi")

    set setWdpObjects   = objWbemServices.ExecQuery ("SELECT * FROM WDP_Control")

     

    for each objWdp in setWdpObjects

     objWdp.CurrentMode  = WDP_MODE_COMMIT

     objWdp.Put_

    next

     

     

     

    Discard.vbs

    Code Snippet

    set dateTime = CreateObject ("WBemScripting.SWbemDateTime")

    Const WDP_MODE_DISCARD = 0

     

    ' Identify the computer to manage

    strComputer= "."

     

    set objWbemServices = GetObject ("winmgmts:\\" & strComputer & "\root\wmi")

    set setWdpObjects   = objWbemServices.ExecQuery ("SELECT * FROM WDP_Control")

     

    for each objWdp in setWdpObjects

     objWdp.CurrentMode  = WDP_MODE_DISCARD

     objWdp.Put_

    next

     

     

    The Commit.vbs & Discard.vbs were picked up from the following thread:

    http://forums.microsoft.com/WindowsToolsandUtilities/ShowPost.aspx?PostID=1790875&SiteID=69

     

    The above method works on my computer. I hope it also works on yours. If anyone can combine Commit.vbs & Save.bat, that will be great.

     

    Best Regards,

     

    Thursday, September 6, 2007 12:16 PM

All replies

  • Hi Inoxx,

     

    Unfortunately, the "Save changes on next restart" option is unavailable in SteadyState. I understand that it will be a little inconvenient without this feature. Related feature request has been reported to our product team for further consideration. If this feature will be back in the new version of SteadyState, we will post the information here ASAP.

     

    Based on the current situation, we have the following two workaround:

     

    Method 1: Use the reminder feature of SteadyState

    ===================

    Actually, there is a similar feature when Windows Disk Protection (WDP) is set to “Remove all changes at restart”. If you shut down the system from an administrator account, a warning message will prompt you to choose whether to save the changes. I have include the message below:

     

    ~~~~~~~~~~~~~~~~~~

    Windows Disk Protection Is On

     

    The computer is about to restart or shut down. You must select one of the following three options in the time remaining or the computer will automatically continue and remove all changes.

     

    Time remaining: 00:30

     

    Continue and remove all changes

    -----------

    If you choose this option, you will lose all changes when the computer is restarted or shut down because Windows Disk Protection is set to Remove all changes at restart.

     

    Save changes and then continue

    -----------

    After the changes are saved, the Remove all changes at restart settings will be turned back on for the next session.

     

    Cancel and go back

    -----------

    If you choose this option, the computer will not restart or shut down.

     

               OK

    ~~~~~~~~~~~~~~~~~~

     

    You can choose “Save changes and then continue” to save changes at the restart. When the computer restarts, the “Remove all changes at restart” option will be enabled automatically.

     

     

    Method 2: Simulate this function with scripts & bat file.

    ===================

    I simulated this feature with three files: Save.bat, Commit.vbs, Discard.vbs.

     

    When you run Save.bat, the first line will add a key to the registry, it will make Discard.vbs run once on the next restart. The second line will run Commit.vbs under C:\test\

    Commit.vbs will change the WDP mode to “Retain all changes permanently”

    Discard.vbs will change the WDP mode to “Remove all changes at restart”.

     

    Thus, the total result will be: Changes will be saved on this restart. WDP will be restored to “Remove all changes at restart” after restarting the computer.

     

    Save.bat

    Code Snippet

    Reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /t REG_SZ /v WDP_s2 /d  C:\test\Discard.vbs /f

    C:\test\Commit.vbs

     

     

     

    Commit.vbs

    Code Snippet

    set dateTime = CreateObject ("WBemScripting.SWbemDateTime")

    Const WDP_MODE_COMMIT = 2

     

    ' Identify the computer to manage

    strComputer= "."

     

    set objWbemServices = GetObject ("winmgmts:\\" & strComputer & "\root\wmi")

    set setWdpObjects   = objWbemServices.ExecQuery ("SELECT * FROM WDP_Control")

     

    for each objWdp in setWdpObjects

     objWdp.CurrentMode  = WDP_MODE_COMMIT

     objWdp.Put_

    next

     

     

     

    Discard.vbs

    Code Snippet

    set dateTime = CreateObject ("WBemScripting.SWbemDateTime")

    Const WDP_MODE_DISCARD = 0

     

    ' Identify the computer to manage

    strComputer= "."

     

    set objWbemServices = GetObject ("winmgmts:\\" & strComputer & "\root\wmi")

    set setWdpObjects   = objWbemServices.ExecQuery ("SELECT * FROM WDP_Control")

     

    for each objWdp in setWdpObjects

     objWdp.CurrentMode  = WDP_MODE_DISCARD

     objWdp.Put_

    next

     

     

    The Commit.vbs & Discard.vbs were picked up from the following thread:

    http://forums.microsoft.com/WindowsToolsandUtilities/ShowPost.aspx?PostID=1790875&SiteID=69

     

    The above method works on my computer. I hope it also works on yours. If anyone can combine Commit.vbs & Save.bat, that will be great.

     

    Best Regards,

     

    Thursday, September 6, 2007 12:16 PM
  •  

    For all of you desperately seeking for a scriptable solution I want to point you to the following possible solution which I happened to find myself today.

     

    It's about a (undocumented?) registry key which exactly does what I wanted; save changes permanently during next reboot and keep WDP mode to “Remove all changes at restart”. Of course, as administrator of 800+ workstations I want this all to be scriptable for use with Ghost images, autologon, post-image runs etcera.

     

    Well I found these registry keys (Windows XP SP3, Windows SteadyState 2.5):

    Code Snippet

     

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Windows SteadyState\Parameters]
    "AutomaticUpdateDay"=dword:00000000
    "AutomaticUpdateTime"=dword:00000003
    "UpdateScriptTimeLimitMinutes"=dword:0000001e
    "EnableAutomaticUpdates"=dword:00000001
    "UpdatesDisableNotify"=dword:00000000
    "WUNotificationLevel"=dword:00000004
    "NoAutoUpdate"=dword:00000000
    "PreviousHibernationSetting"=dword:00000000
    "DontWarnOnDiscard"=dword:00000001
    "DelayedUninstall"=dword:00000000
    "PostUninstall"=dword:00000000
    "RestoreDiscardModeNextBoot"=dword:00000000
    "SingleCommitRequested"=dword:00000000

     

     

    I assume you've already found about the vbs scripts to change de WDP modes. I want to point you to the registry key RestoreDiscardModeNextBoot which, when set to dword:00000001, in combination with WDP mode "Save changes permanently" does the following:

     

    Save all changes for this Windows session permanently on the next reboot and during that reboot switches WDP mode to "Remove all changes at restart".

     

    So all you administrators have to do is:

    • make a batch to do your thing (config change, installation, delete autologon, etcetera)
    • use a VBS script to change WDP mode to WDP_MODE_COMMIT (see commit.vbs as mentioned above)
    • set registry key RestoreDiscardModeNextBoot to dword value 1
    • reboot the machine

    I hope this might be of some help to all of you. Our team has been struggling for days to get this functionality (which exists in Shared Toolkit) for SteadyState.

     

     

    • Proposed as answer by JulesLondon Tuesday, September 29, 2009 2:03 PM
    Friday, June 20, 2008 10:10 PM
  • Ruud, your solution rocks... thanks so much..

    "RestoreDiscardModeNextBoot"=dword:00000001

    I am deploying via SCCM task sequences. My second to  last task in the sequence is to tell the PC to remove all WDP changes. The last SCCM task is to shutdown the PC - a requirement.

    It works - WDP is turned off and the PC shuts down, but when the PC reboots, it "forgets" that the SCCM task "shutdown" has run as all changes were discarded.. Therefore the shutdown task runs again upon system startup, when it reboots and picks it up from SCCM. It constantly continues to do this until the advertisment is removed.

    Thanks again
    Jules
    Tuesday, September 29, 2009 2:11 PM