[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 644
  • Last Modified:

vb 6 class does not support automation or does not support expected interface after xpsp2 install

I got this error after install xp sp2

"class does not support automation or does not support expected interface after xpsp2 install"


'List all server ip adapters
Dim IPconfig As WbemScripting.SWbemObject
ERROR ON THIS LINE!-->  Set IPconfigSet = GetObject("winmgmts:").ExecQuery("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPconfig In IPconfigSet
    If Not IsNull(IPconfig.IPAddress) Then
        For I = LBound(IPconfig.IPAddress) To UBound(IPconfig.IPAddress)
            ConsoleSettingsFrm.ConsoleIPBox.AddItem IPconfig.IPAddress(I)
        Next
    End If
Next


My references are as follows:

VB for applications
VB runtime objectes and procedures
vb objects and procedures
microsoft wmi scripting v1.2 library
microsoft dialog automation objects
microsoft scripting runtime
ole automation


Which reference dll or tlb is the problems (obviously xp sp2 over wrote one of them)....

Whwat reference does that error line of code use??



0
bluedragon99
Asked:
bluedragon99
2 Solutions
 
Eduard GherguCommented:
Hello!
Please, add an error trapping code (On Error Goto ErrHandler) and provide me the error code that should be one of the followings:
wbemErrAccessDenied (0x80041003) = Current user does not have permission to view the result set.
wbemErrFailed (0x80041001) = Unspecified error.
wbemErrInvalidParameter (0x80041008) =  Invalid parameter was specified.
wbemErrInvalidQuery (0x80041017) = Query syntax is not valid.
wbemErrInvalidQueryType (0x80041018) =  Requested query language is not supported.
wbemErrOutOfMemory (0x80041006) = Not enough memory to complete the operation.
0
 
jacobhooverCommented:
Hmmm, try this:

Dim IPconfig As Object
Set IPconfigSet = GetObject("winmgmts:").ExecQuery("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPconfig In IPconfigSet
    If Not IsNull(IPconfig.IPAddress) Then
        For I = LBound(IPconfig.IPAddress) To UBound(IPconfig.IPAddress)
            ConsoleSettingsFrm.ConsoleIPBox.AddItem IPconfig.IPAddress(I)
        Next
    End If
Next

By definition, the error you are seeing is from:
Dim IPconfig As WbemScripting.SWbemObject
Set IPconfigSet = GetObject("winmgmts:").ExecQuery("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

What it's saying is either GetObject("winmgmts:") dosen't return an object of WbemScripting.SWbemObject OR that the WbemScripting.SWbemObject no longer supports the call to ExecQuery.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now