Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

SwbemObjectEx: Class not registered

$
0
0

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?



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>