title: How to update windows registry each 2 minutes?
body: <p>I am writing a scrip in VBA which will monitor the registry value and if it changes the script will overwrite it. Till now I wrote an script which checks the value in the registry and updates it to given value. But my problem is how to update the registry each 2 minutes or when the value changes ? Please help !!!</p>
  
  <pre><code>On Error Resume Next
  HKEY_CURRENT_USER = &amp;H80000001
  strComputer = "."
  Set objReg = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\default:StdRegProv")
  strKeyPath = "Control Panel\Desktop"
  ValueName = "ScreenSaveActive"
      objReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue
      objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
  If IsNull(strValue) Then
      Wscript.Echo "The value is either Null or could not be found in the registry."
  Else
      Wscript.Echo "Value: ", strValue
      strValue = "1"
      objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue
      Wscript.Echo "Value after change ", strValue
  End If
  </code></pre>
  
  <p>Regards,
  Erni</p>