Re: Scriptomatic



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@xxxxxxxxx> wrote in message
> news:1112762033.208733.287000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > 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>
> >

.



Relevant Pages

  • Re: Need help getting processor utilization stats with WMI
    ... Here are the two scripts I've tried: ... > Set colItems = objWMIService.ExecQuery("Select * from ... > Wscript.Echo ProcTime1 ... > WScript.Echo TimeStamp1 ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Computer Inventory - Win32_PhysicalMemory
    ... two scripts I do indeed receive the correct information (read: ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ... For Each objItem in colItems ...
    (microsoft.public.win32.programmer.wmi)
  • RE: WMI filter for IPAddress
    ... I am not quite sure what you mean by "full scripts to filter" but you can get ... the array info out. ... Set colItems = objWMIService.ExecQuery("Select IPAddress from ...
    (microsoft.public.windows.server.scripting)
  • Re: Automating the printing of a document
    ... Set colItems = objFolder.Items ... I think you can set the default printer with WMI scripts. ... http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) ...
    (microsoft.public.scripting.vbscript)
  • Re: Daylight saving time script - to confirm current status
    ... Could you run your eyes over this please? ... pieces from different scripts to make this work... ... Dim objNet ... Set colItems = objWMIService.ExecQuery("SELECT * FROM ...
    (microsoft.public.windows.server.scripting)