Text output format

Posted: 07-14-2006, 06:37 PM
I'm using the following to ouput properties from the
Win32_ComputerSystem class. I want to include properties from the
Win32_OperatingSystem class on the same line as the
Win32_ComputerSystem class. I'm not sure how I would do this.

Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem",,48)
For Each objItem in colItems

objFile.WriteLine objItem.Name & "," & objItem.Model "," &
objItem.Caption


Thanks in advance
Rick

Reply With Quote

Responses to "Text output format"

Marty List
Guest
Posts: n/a
 
Re: Text output format
Posted: 07-15-2006, 03:38 PM

This is more of a VBScript question than WMI. You should store the WMI
values in variables, so you can use them later in your script. Also, you
should declare variables with "Dim" and always use "Option Explicit" as the
first line in your script.

Watch out for line wraps:

Option Explicit
Dim strComputer, objWMIService, colItems, objItem
Dim ComputerName, ComputerModel, ComputerCaption, OsCaption

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from
Win32_ComputerSystem",,48)
For Each objItem in colItems
ComputerName = objItem.Name
ComputerModel = objItem.Model
ComputerCaption = objItem.Caption
Next

Set colItems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem",,48)
For Each objItem in colItems
OsCaption = objItem.Caption
Next

objFile.WriteLine ComputerName & "," & ComputerModel & "," & ComputerCaption
& "," & OsCaption



"Rick" <drummer10980@gmail.com> wrote in message
news:1152898662.699858.191790@75g2000cwc.googlegro ups.com...
> I'm using the following to ouput properties from the
> Win32_ComputerSystem class. I want to include properties from the
> Win32_OperatingSystem class on the same line as the
> Win32_ComputerSystem class. I'm not sure how I would do this.
>
> Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> "\root\cimv2")
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_ComputerSystem",,48)
> For Each objItem in colItems
>
> objFile.WriteLine objItem.Name & "," & objItem.Model "," &
> objItem.Caption
>
>
> Thanks in advance
> Rick
>

Reply With Quote
Rick
Guest
Posts: n/a
 
Re: Text output format
Posted: 07-16-2006, 03:14 PM
Marty,
Thank you for the answer

Rick


Marty List wrote:
> This is more of a VBScript question than WMI. You should store the WMI
> values in variables, so you can use them later in your script. Also, you
> should declare variables with "Dim" and always use "Option Explicit" as the
> first line in your script.
>
> Watch out for line wraps:
>
> Option Explicit
> Dim strComputer, objWMIService, colItems, objItem
> Dim ComputerName, ComputerModel, ComputerCaption, OsCaption
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
>
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_ComputerSystem",,48)
> For Each objItem in colItems
> ComputerName = objItem.Name
> ComputerModel = objItem.Model
> ComputerCaption = objItem.Caption
> Next
>
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_OperatingSystem",,48)
> For Each objItem in colItems
> OsCaption = objItem.Caption
> Next
>
> objFile.WriteLine ComputerName & "," & ComputerModel & "," & ComputerCaption
> & "," & OsCaption
>
>
>
> "Rick" <drummer10980@gmail.com> wrote in message
> news:1152898662.699858.191790@75g2000cwc.googlegro ups.com...
> > I'm using the following to ouput properties from the
> > Win32_ComputerSystem class. I want to include properties from the
> > Win32_OperatingSystem class on the same line as the
> > Win32_ComputerSystem class. I'm not sure how I would do this.
> >
> > Set objWMIService = GetObject("winmgmts:\\" & strComputer &
> > "\root\cimv2")
> > Set colItems = objWMIService.ExecQuery("Select * from
> > Win32_ComputerSystem",,48)
> > For Each objItem in colItems
> >
> > objFile.WriteLine objItem.Name & "," & objItem.Model "," &
> > objItem.Caption
> >
> >
> > Thanks in advance
> > Rick
> >
Reply With Quote
 
LinkBack Thread Tools Display Modes
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reccording DOS output to a text file senrabdet Windows Vista Security 3 08-10-2006 01:15 PM
Reading text aloud .... text to speech features fkissam Windows XP Help & Support 3 10-07-2003 10:35 AM
avi format convert to Mpeg format...is that anyway i can doing...? PapaJohn Windows XP Movie Maker 0 07-22-2003 02:06 PM
mouseover drop down text overlaps text on page, unreadable! Molly Windows XP Basics 0 07-18-2003 05:42 AM
Mouseover text overlaps text on page Molly Customize Windows XP 0 07-16-2003 05:25 AM


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90