• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • 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 GherguLeader SibiuCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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