Re: Scriptomatic by leadfingers
leadfingers
Wed Apr 06 14:01:18 CDT 2005
This sample is taken from the WMI Class Win32_Registry.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("CTS-WB217Q31")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM
Win32_Registry", "WQL", _
wbemFlagReturnImmediately +
wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "Caption: " & objItem.Caption
WScript.Echo "CurrentSize: " & objItem.CurrentSize
WScript.Echo "Description: " & objItem.Description
WScript.Echo "InstallDate: " &
WMIDateStringToDate(objItem.InstallDate)
WScript.Echo "MaximumSize: " & objItem.MaximumSize
WScript.Echo "Name: " & objItem.Name
WScript.Echo "ProposedSize: " & objItem.ProposedSize
WScript.Echo "Status: " & objItem.Status
WScript.Echo
Next
Next
Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" &
Mid(dtmDate,13, 2))
End Function
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have tried several of the other scripts from Scriptomatic2, all with
the same result. Since I'm using Windows XP, I felt that versions would
not be the problem, but then I get the impression from what I've read,
is that all the scripts in Scriptomatic should work. Since this is all
new to me, I'm way out in the dark?
Thanks for your response.
Dean
Andrew Madsen wrote:
> Can you post a sample of the script in question?
>
> --
> Andrew C. Madsen
> Network Specialist
> Harley-Davidson Motor Company
> "leadfingers" <ddean2@qwest.net> wrote in message
> news:1112762033.208733.287000@l41g2000cwc.googlegroups.com...
> > Any script I try to run from scriptomatic, fails at the
> >
> > "For Each objItem In colItems"
> >
> > I'm running the scrips, (and scriptomatic as well) from WinXP. I've
> > also tried on the scripts several other PC's with the same result.
Is
> > there something I need to add to the scripts to make them function?
> >
> > What I get back when running the scrips is something like..( I do
have
> > to rem out the first line, on error resume next, in order to get a
dos
> > shell with the following)
> >
> >
> > ==========================================
> > Computer: Script-tester
> > ==========================================
> > C:\Scripts\Scriptomatic2\temp_script.sm(17, 4) (null): 0x80041003
> >
> >
> > C:\Scripts\Scriptomatic2>
> >