Jump to content

Recommended Posts

Posted

I have posted the following in the programming section, but am not sure if this is a more appropriate section. Admin please delete the one you feel should go if its a problem having them in 2 places.

Would it be possible with the use of WMI and VB to automatically create an oeminfo.ini file for use within Windows?

Here is the sample from MS:

[General]

Manufacturer = MyCompany, Inc.

Model = Brand X Processor

SupportURL = http://www.mycompany.com

LocalFile = C:\Winnt\Web\LocalFilename.htm

[support Information]

Line1= For Technical Support:

Line2= to obtain updated drivers or for information on frequently

Line3= asked questions, visit the MyCompany technical

Line4= support web site at:

Line5=

Line6= http://www.mycompany.com/techsupport.

Would it be possible for WMI to enter Manufacturer, Model and add other information such as CPU, Ram, HDD, Graphics and Sound Card information under the general tab. As well as creating the lines under support information?

then to save all this information to %SYSTEMROOT%\System32\oeminfo.ini

If this could be done, i think it will be a useful script that can be used in an UA install or manual install and will be easy for an end user to se what is installed in their PC and for IT professionals for more efficint hardware auditing.

What do people think, worth looking into??

:no: / :thumbup ??


Posted

You could get the Manufacturer and Model using WMI (and Serial# if you know where that partiucular manufacturer keeps it). The first time you can use WMI is during GuiRunOnce. There is no way to get the support information using WMI so either you will have to leave it out or create a template (or select from multiple templates based on the manufacturer).

I am working on a project the reads the SMBIOS table directly from memory bypassing WMI so that I can have this information availabe from cmdlines.txt.

Posted (edited)

sorry m8, I worded that wrong. I would like wmi to get manufacturer, model, serial number, cpu, ram, hdd, graphics and sound card info and output this to an oeminfo.ini. I know howto get some of the information, but don't know how to add it to an oeminfo.ini file and to wscript.echo out to the correct line. Can you wscript.echo out to a specific line in an .ini file? If so how?

I was thinking that you could wscript.echo "[General]" to line 1, "Manufacturer = " & objItem.Manufacturer to Line 2, "Model = " & objItem.Model to Line 3, Line 4 can be a blank line, "[Hardware]" to line 5, "Total Physical Memory = " & objItem.TotalPhysicalMemory to Line 6, "[support Information]" to Line 12, and so on and save all of this into %systemroot%\system32\oeminfo.ini

'---------------------------------------------------------------------------------------------------------------------

On Error Resume Next

Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

arrComputers = Array("PC2") ;How do i get a computername variable in here??

For Each strComputer In arrComputers

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

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _

wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems

WScript.Echo "Manufacturer: " & objItem.Manufacturer

WScript.Echo "Model: " & objItem.Model

WScript.Echo "TotalPhysicalMemory: " & objItem.TotalPhysicalMemory

Next

Next

For Each strComputer In arrComputers

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

Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _

wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems

WScript.Echo "SerialNumber: " & objItem.SerialNumber

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

Edited by kev_147
Posted (edited)

You may want to check out some of the sample code that GunSmokingMan has posted or even go to my thread for the post install script pack. You're bound to find an example of just about anything that you would ever need.

EDIT: I just saw that you've done that ;)

Edited by RogueSpear

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...