I am using the below script to write the data path of my application to the registry.
Function WriteRegValue(KeyPath,ValueName,Value,ValueType)
Dim strComputer, oReg
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
If (ValueType = "DWORD") Then
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,KeyPath,ValueName,Value
Else
oReg.SetStringValue HKEY_LOCAL_MACHINE,KeyPath,ValueName,Value
End If
End Function
Dim strKeyPath, path, STR
path = "C:\ProgramData\"
strKeyPath = "SOFTWARE\NewSW\Path"
Call WriteRegValue(strKeyPath,"DataPath",path,STR)
But when i execute the script, i get the error SwbemObjectEx: Class not Registered.
I have tried to re-register the wbemdisp.dll, but it doesn't help.
Could you please help me find a solution for this?