Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
scripts
hosting
jscript
remote
scripting.wsh
scriptlets
vbscript
virus.discussion
  
 
date: Tue, 19 Apr 2005 08:14:03 -0700,    group: microsoft.public.scripting.vbscript        back       


ActiveX component can't create object: 'WbemScripting.Swbemrefresh   
Hello,

I'm trying to debug a script I got online and that keeps generating the 
following error:

Error: ActiveX component can't create object: 'WbemScripting.Swbemrefresher'
Code: 800A01AD
Source: Microsoft VBScript runtime error

Script Code Starts Here---------------------

Const ForAppending = 8
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" 
& strComputer & "\root\cimv2")
set objRefresher = CreateObject("WbemScripting.Swbemrefresher")
Set objMemory = objRefresher.AddEnum _
  (objWMIService, "Win32_PerfFormattedData_PerfOS_Memory").objectSet
Set objDiskSpace = objRefresher.AddEnum _
  (objWMIService, "Win32_PerfFormattedData_PerfDisk_LogicalDisk").objectSet
Set objQueueLength = objRefresher.AddEnum _
  (objWMIService, 
"Win32_PerfFormattedData_PerfNet_ServerWorkQueues").objectSet
objRefresher.Refresh
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.OpenTextFile _
  ("c:\scripts\performance.csv", ForAppending, True)
For I = 1 to 10
  For each intAvailableBytes in objMemory
      objLogFile.Write(intAvailableBytes.AvailableMBytes) & "," 
  Next
  For each intQueueLength in objDiskSpace
      objLogFile.Write(intQueueLength.CurrentDiskQueueLength) & "," 
  Next
  For each intServerQueueLength in objQueueLength
      objLogFile.Write(intServerQueueLength.QueueLength) & ","
  Next
  objLogFile.Write VbCrLf
  Wscript.Sleep 10000
  objRefresher.Refresh
Next
objLogFile.Close

Script Code Ends Here---------------------

I am running win2k with office 2003.
Any help is appreciated!  Please keep in mind I am very new to scripting.

Thanks,

Dan
date: Tue, 19 Apr 2005 08:14:03 -0700   author:   Daniel

Re: ActiveX component can't create object: 'WbemScripting.Swbemrefresh   
It sounds like the WbemScripting library is not registered.  If you can find
the appropriate DLL, try running regsvr32 on it.  If it still doesn't work
.... I'm having the same problem w/ a totally different DLL.  Not sure what
to say.

WbemScripting appears to be part of Windows Management Instrumentation. You
MAY need to install the WMI SDK from
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

I haven't worked w/ WMI, so I'm not sure what you need to install & what is
installed w/ Windows.


-- 
Daniel Wilson
Senior Software Solutions Developer
Embtrak Development Team
http://www.Embtrak.com
DVBrown Company

"Daniel"  wrote in message
news:1E30C15D-17A3-439D-A6CF-86ECE9158613@microsoft.com...
> Hello,
>
> I'm trying to debug a script I got online and that keeps generating the
> following error:
>
> Error: ActiveX component can't create object:
'WbemScripting.Swbemrefresher'
> Code: 800A01AD
> Source: Microsoft VBScript runtime error
>
> Script Code Starts Here---------------------
>
> Const ForAppending = 8
> strComputer = "."
> Set objWMIService =
GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
> & strComputer & "\root\cimv2")
> set objRefresher = CreateObject("WbemScripting.Swbemrefresher")
> Set objMemory = objRefresher.AddEnum _
>   (objWMIService, "Win32_PerfFormattedData_PerfOS_Memory").objectSet
> Set objDiskSpace = objRefresher.AddEnum _
>   (objWMIService,
"Win32_PerfFormattedData_PerfDisk_LogicalDisk").objectSet
> Set objQueueLength = objRefresher.AddEnum _
>   (objWMIService,
> "Win32_PerfFormattedData_PerfNet_ServerWorkQueues").objectSet
> objRefresher.Refresh
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objLogFile = objFSO.OpenTextFile _
>   ("c:\scripts\performance.csv", ForAppending, True)
> For I = 1 to 10
>   For each intAvailableBytes in objMemory
>       objLogFile.Write(intAvailableBytes.AvailableMBytes) & ","
>   Next
>   For each intQueueLength in objDiskSpace
>       objLogFile.Write(intQueueLength.CurrentDiskQueueLength) & ","
>   Next
>   For each intServerQueueLength in objQueueLength
>       objLogFile.Write(intServerQueueLength.QueueLength) & ","
>   Next
>   objLogFile.Write VbCrLf
>   Wscript.Sleep 10000
>   objRefresher.Refresh
> Next
> objLogFile.Close
>
> Script Code Ends Here---------------------
>
> I am running win2k with office 2003.
> Any help is appreciated!  Please keep in mind I am very new to scripting.
>
> Thanks,
>
> Dan
date: Tue, 19 Apr 2005 12:26:12 -0400   author:   Daniel Wilson

Re: ActiveX component can't create object: 'WbemScripting.Swbemrefresh   
Daniel wrote:
> Hello,
>
> I'm trying to debug a script I got online and that keeps generating
> the following error:
>
> Error: ActiveX component can't create object:
> 'WbemScripting.Swbemrefresher' Code: 800A01AD
> Source: Microsoft VBScript runtime error

When in doudt, check the docs...

SWbemRefresher object [WMI]
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/swbemrefresher.asp?frame=true

See the Requirements section near the bottom of the page (hint requires XP 
or higher)...

-- 
Michael Harris
Microsoft MVP Scripting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Please ask follow-up questions via the original newsgroup thread.
date: Tue, 19 Apr 2005 17:55:47 -0700   author:   Michael Harris \(MVP\) mikhar at mvps dot org

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us