<WriteActionModuleType ID="EDC.Base.DeleteRegistryValue.Script.WriteAction" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="RegistryPath" type="xsd:string"/>
</Configuration>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="Script" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
<ScriptName>DeleteRegistryValue.vbs</ScriptName>
<Arguments>"$Config/RegistryPath$"</Arguments>
<ScriptBody><Script>
Option Explicit
'***********************************************************************************************************
' Disclaimer
'
' This sample script is not supported under any Microsoft standard support program or service. This sample
' script is provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties
' including, without limitation, any implied warranties of merchantability or of fitness for a particular
' purpose. The entire risk arising out of the use or performance of this sample script and documentation
' remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation,
' production, or delivery of this script be liable for any damages whatsoever (including, without limitation,
' damages for loss of business profits, business interruption, loss of business information, or other
' pecuniary loss) arising out of the use of or inability to use this sample script or documentation, even
' if Microsoft has been advised of the possibility of such damages.
'
'***********************************************************************************************************
' DeleteRegistryValue 1.0 v20090313
'
' Creates or overwrites a registry value.
'
' Arguments: <registrypath> <valuetype> <value> [<force>]
'
' RegistryPath: Full path of the key or value to delete. A key must end with a backslash ("\").
'
' Version for Operations Manager 2007
'
' JM
'***********************************************************************************************************
'Script specific constants
'Const SCRIPT_NAME = "DeleteRegistryValue"
Const SCRIPT_VERSION = "1.0"
Call Main
'********************************************************************************
' PROCEDURE: Main
' DESCRIPTION: Read the argument and deletes the given registry key or value.
' PARAMETERS: void
'******************************************************************************
Private Sub Main()
Dim strRegistryPath 'As String
Dim objWSHShell 'As WScript.Shell
Call SetLocale("en-us")
If Not GetScriptParameters(strRegistryPath) Then
Call WScript.Echo("Error! An argument is missing." & vbCrLf & "Syntax: cscript SetRegistryValue.vbs <registrypath>")
Exit Sub
End If
Set objWSHShell = CreateObject("WScript.Shell")
On Error Resume Next
Call objWSHShell.RegDelete(strRegistryPath)
If Err.Number = 0 Then
Call WScript.Echo("Successfully deleted '" & strRegistryPath & "'.")
Else
Call WScript.Echo("Error! Failed to delete '" & strRegistryPath & "'." & vbCrLf & _
Err.Description)
End If
End Sub
'******************************************************************************
' FUNCTION: GetScriptParameters
' DESCRIPTION: Reads the script's parameters and sets the variables accordingly.
' PARAMETERS: OUT String strRegistryPath:
' RETURNS: Boolean: True if successful
'******************************************************************************
Private Function GetScriptParameters(ByRef strRegistryPath) 'As Boolean
Dim objArguments
On Error Resume Next
Set objArguments = WScript.Arguments
If objArguments.Count < 1 Then Exit Function
'Get parameters and set global variables
strRegistryPath = objArguments(0)
If Len(strRegistryPath) > 0 Then GetScriptParameters = True
End Function </Script></ScriptBody>
<TimeoutSeconds>30</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="Script"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>