SWbemObjectSet generate error wbemErrFailed = 0 x80041001

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Phil Ten (pt_at_dafweb.com)
Date: 09/04/04


Date: Sat, 4 Sep 2004 12:18:16 +0100

Hello,

I am trying to write a vb script to query a DNS server using WMI.

At first sight my script seem to work fine, but it always fails
when called many times. Typically, the problem will occurs
after 100 to 200 calls. Once the problem occurs the
script will no longer work until stopped and restarted.

At first I suspected a cleanup related issue, but I couldn't
find any information on how to cleanup/release WMI
object. All samples script I view seem to not worry about
cleanup.

The script below generates the problem every times.

'-----------------------------------------------

    Set objLocator = CreateObject("WbemScripting.SWbemLocator")
    If Err.Number Then Exit Function

    Set objService = objLocator.ConnectServer("192.168.0.7",
"root\microsoftdns", "", "")
    objService.Security_.impersonationlevel = 3

    For i = 1 To 10000

        Set objDns = objService.ExecQuery("Select * from
MicrosoftDNS_ResourceRecord where (RecordClass=1) and
(OwnerName='phil237.iispro.net')", , 48)

        '!!!!!!!! after 100 to 200 loop the line below generates error
wbemErrFailed = 0 x80041001
        For Each objInst In objDns
                tmp = objInst.TextRepresentation
        Next

    Next

'---------------------------------------------------

My configurations:
-Development: Windows Server 2003 Web + MS Access 2002 VBA
-DNS server: Windows 2000 Server + wmi dnsprov

Thank you in advance for all help.

Phil. Ten.



Relevant Pages

  • RE: Does WMI have to be installed on Remote Computer?
    ... IMHO this looks like a well constructed and very vell commented script. ... WMI comes as standard on w2k w2k3 and xp, ... does WMI need to be installed on the remote computer in order for a ... ''' First try to ping the server. ...
    (microsoft.public.scripting.vbscript)
  • Does WMI have to be installed on Remote Computer?
    ... I'm new to WMI, learning as I go. ... does WMI need to be installed on the remote computer in order for a ... script which uses WMI to work? ... ''' First try to ping the server. ...
    (microsoft.public.scripting.vbscript)
  • Re: Error on 64 bit systems...
    ... Try logging on to the 64-bit system and running the script from that system against itself and against other servers. ... At this point, we're not seeing any errors that would indicate breakage in WMI or an odd configuration, so the problem is apparently rather well-hidden. ... Running the code on the 64-bit server will fill in the picture. ... If it runs ok locally but doesn't run against the remote systems, there's a symmetric problem - likely something with the credentials being used. ...
    (microsoft.public.scripting.vbscript)
  • Re: How can I kill a stuck cmd.exe remotely?
    ... sample script code... ... Microsoft MVP - Windows Server Management Infrastructure ... > the cmd would stuck for some reasons I did not know. ... > something in order to run the WMI thing? ...
    (microsoft.public.windowsxp.wmi)
  • Re: change local admin password on remote computers
    ... Start tthe script remotely on the server, let it eg. mail the results. ... Or place the script on the remote machine, start it over WMI and let the ...
    (microsoft.public.scripting.vbscript)