Re: Program to get hardware info?




"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx> wrote in
message news:udGIPhkCKHA.4608@xxxxxxxxxxxxxxxxxxxxxxx

"steve" <stevesemple@xxxxxxxxx> wrote in message
news:dd2a86f0-7e78-4ebf-89c5-f329c08ca50d@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I'm not a vbs script person I admit. I kind of poke around and glue a
few things together to get what I need.

In this case I need a simple program that can print out basic info
about a computer so that we can paste it on top of the cases for a
quick summary of what is in the case.

I found this nice little vbs script that does almost what I want.
However I want to add a few more features to it to give some
additional info.

What is missing in it is ...

I want the Name of the C drive (we actually give the drives a Serial
number that tells us the SN of the comptuer)

I want the video card info basic model and info,

I want the Nic info. eg what type of card it is so that we can know
what drivers it needs

What USB ports are available,

And I think finally the MB info that is what is the MB Mnf, and data
so that if we need drivers for it we can find them.

The rest is covered by the program that I have edited.

I have looked but I cant seem to find the information I need to edit
this file and give me the output I would like. Again Im just basic in
my scripting abilities.

save and rename hardware.vbs
----------------
'==========================================================================
'
' NAME: <MemProcDiskInventory.vbs>
'
' AUTHOR: Mark D. MacLachlan , ITSynergy
' DATE : 5/15/2003
'
' COMMENT: <Inventories computer configuration and writes report to
disk>
'==========================================================================
on error resume Next

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")
strComputer = env.Item("Computername")
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
\"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")


report = strComputer & " Computer Inventory" & vbCrLf &
"******************************************" & vbCrLf & vbCrLf
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root
\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from
Win32_OperatingSystem",,48)

report = report & vbCrLf &
"******************************************" & vbCrLf
report = report & "OS Information" & vbCrLf &
"******************************************" & vbCrLf & vbCrLf
For Each objItem in colItems
report = report & strComputer & vbCrLf & "OS Details"& vbCrlf
report = report & "Caption: " & objItem.Caption & vbCrLf
report = report & "Description: " & objItem.Description & vbCrLf
report = report & "InstallDate: " & objItem.InstallDate & vbCrLf
report = report & "Manufacturer: " & objItem.Manufacturer &
vbCrLf
report = report & "Name: " & objItem.Name & vbCrLf
report = report & "Organization: " & objItem.Organization &
vbCrLf
report = report & "RegisteredUser: " & objItem.RegisteredUser &
vbCrLf
report = report & "SerialNumber: " & objItem.SerialNumber &
vbCrLf
report = report & "ServicePackMajorVersion: " &
objItem.ServicePackMajorVersion & vbCrLf
report = report & "ServicePackMinorVersion: " &
objItem.ServicePackMinorVersion & vbCrLf
report = report & "Version: " & objItem.Version & vbCrLf
Next

Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
report = report & vbCrLf &
"******************************************" & vbCrLf
report = report & "Memory and Processor Information" & vbCrLf &
"******************************************" & vbCrLf & vbCrLf
For Each objComputer in colSettings
report = report & objComputer.TotalPhysicalMemory /1024\1024+1 & "MB
Total memory" & vbcrlf
Next
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_Processor")
For Each objProcessor in colSettings
report = report & objProcessor.Description & " Processor" & vbCrLf
Next

report = report & vbCrLf &
"******************************************" & vbCrLf
report = report & "Disk Drive Information" & vbCrLf &
"******************************************" & vbCrLf & vbCrLf

Set objWMIService = GetObject("winmgmts:")
Set objLogicalDisk = objWMIService.Get
("Win32_LogicalDisk.DeviceID='c:'")
report = report & objLogicalDisk.FreeSpace /1024\1024+1 & "MB Free
Disk Space" & vbCrLf
report = report & objLogicalDisk.Size /1024\1024+1 & "MB Total Disk
Space" & vbCrLf


Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.CreateTextFile (strComputer & ".txt", ForWriting)
ts.write report
ts.write software
MsgBox Report
MsgBox "Done"



Once you have the script above that uses WMI, you just need to find the
classes that have the properties you want. There are many examples in the
Script Center. For example, for memory and video:

http://www.microsoft.com/technet/scriptcenter/scripts/hardware/default.mspx

Network configuration info:

http://www.microsoft.com/technet/scriptcenter/scripts/network/client/list/default.mspx

Disks and volumes:

http://www.microsoft.com/technet/scriptcenter/scripts/storage/disks/drives/default.mspx

The Win32_USBController class should help with USB ports. You can browse
the Script Center for ideas. Once you know the class, such as
Win32_ComputerSystem, you can search online for more information on the
properties exposed. For example, here is a hit for Win32_USBController:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/feb06/hey0208.mspx

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


Hi,Richard
Do the links you posted give a more complete list of what info is actually
available on a specific computer than Scriptomatic gives? It is available
here:
http://www.microsoft.com/downloads/details.aspx?familyid=09dfc342-648b-4119-b7eb-783b0f7d1178&displaylang=en

It generates a script in your choice of VBScript, Perl, Python, or JScript,
that, I think, lists all available info for the various classes for the one
particular computer it is run on. By that, I mean that no matter what
version of WMI or what info the OEM has provided, the generated script is
basically a list of the property names that this computer's version of WMI
allows, and the output of the script is a list of values that the OEM or OS
has actually implimented. So I'm wondering if the links you give provide
ways to get additional information.

The generated VBScript uses a global On Error Resume Next statement to
suppress outputting property names for which no values are present, thus
reducing the amount of useless output.

-Paul Randall


.



Relevant Pages

  • Re: [RFC PATCH 1/3] export symbol report: overview
    ... A report generated by executing ... the usage count of all exported symbols by in-kernel modules. ... For each in-kernel module lists ... And then let the perl script pick up default values for where to find ...
    (Linux-Kernel)
  • Re: [RFC PATCH 1/3] export symbol report: overview
    ... A report generated by executing ... the usage count of all exported symbols by in-kernel modules. ... For each in-kernel module lists ... And then let the perl script pick up default values for where to find ...
    (Linux-Kernel)
  • Re: Program to get hardware info?
    ... I found this nice little vbs script that does almost what I want. ... <Inventories computer configuration and writes report to ... report = report & vbCrLf & ... Set colSettings = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.vbscript)
  • Re: Program to get hardware info?
    ... I found this nice little vbs script that does almost what I want. ... <Inventories computer configuration and writes report to ... report = report & vbCrLf & ... Set colSettings = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.vbscript)
  • Send an email
    ... This script is running on a SBS 2003 server with Exchange ... 'Create the Error Report in the root of the first fixed disk. ... MyFile.WriteLine& vbCRLF ... Set WshShell = Nothing ...
    (microsoft.public.scripting.vbscript)