Formatting of WMI Object Information
Posted on 2004-09-29
I don't know a whole lot about VBS, but enough to mess it up I guess. This script originally put all of the hardware information for a computer into a text file and wrote each piece of information to a new line with nice spacing and everything. I needed the info that we wanted to have to be all on one line seperated by commas. I've got most of it working how i want. The only problem I'm having now is I can't stop it from giving me certain information that I do not need. Here are the parts of the script that are in question:
'Physical memory information
strProperties = "MaxCapacity"
'Logical Disk information
strProperties = _
QueryInstances "Win32_LogicalDisk",strProperties,"DriveType!=3 AND DriveType !=4"
'Disk drive information
strProperties = "Model,Size"
strProperties = "Manufacturer,MaxClockSpeed"
strProperties = "MACAddress,ProductName"
"AdapterType='Ethernet 802.3' AND ProductName !='Packet Scheduler Miniport'"
'Video adapter information
strProperties = "Name"
strProperties = "Manufacturer,Version"
If Conditions = "None" Then
strSelect = "Select " & Properties & " From " & objClass
strSelect = "Select " & Properties & " From " & objClass & _
" Where " & Conditions
Set objClassName = _
(strSelect,,wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objComponent in objClassName
intCount = 1
For Each objProperty in objComponent.Properties_
If intCount = 0 Then
If intCount = 1 Then
intCount = 0
If ISNull(objProperty.Value) Then
If objProperty.CIMType <> wbemCimtypeUint32 And _
objProperty.CIMType <> wbemCimtypeUint64 And _
objProperty.CIMType <> wbemCimtypeSint64 Then
objFile.Write(objProperty.Value & _
strUnits = GetUnits(objClass,objProperty.Name)
intValue = _
Here is a sample of the output I'm getting:
HELPDESK1,Microsoft Windows XP Professional,5.1.2600,OptiPlex GX270 ,HELPDESK1,509MB,4GB,Physical Memory Array 0,3 1/2 Inch Floppy Drive,A:,2 ,Removable Disk,D:,2 ,CD-ROM Disc,E:,5 ,CD-ROM Disc,F:,5 ,\\.\PHYSICALDRIVE1,IOMEGA ZIP 250,NULL,\\.\PHYSICALDRIVE0,Maxtor 6E040L0,38.3GB,CPU0,GenuineIntel,2261 megahertz,8,00:0B:DB:77:FD:01,Intel(R) PRO/1000 MT Network Connection,VideoController1,Intel(R) 82865G Graphics Controller,Dell Computer Corporation,Phoenix ROM BIOS PLUS Version 1.10 A02,Phoenix ROM BIOS PLUS Version 1.10 A02,3,0,DELL - 7
I don't want these parts to be in there:
Physical Memory Array
\\.\PHYSICALDRIVE1 and \\.\PHYSICALDRIVE0 as well as the drive numbers for both logical disks and physical disks
and Phoenix ROM BIOS PLUS Version 1.10 A02,3,0,DELL - 7 (I want the first instance of the Phoenix ROM BIOS PLUS Version 1.10 A02 though)