Jump to content

Automatic creation of oeminfo.ini


Recommended Posts

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

Link to comment
Share on other sites


If you're looking to use VB, you'd write a line something like this:

Dim strSystemRoot As String = Environment.ExpandEnvironmentVariables("%SystemRoot%")
Dim oeminfo As New IO.StreamWriter(strSystemRoot & "\System32\OEMINFO.INI", False)
oeminfo.WriteLine("blah blah blah")
oeminfo.Close

Another way to do it, since this is an .ini file, would be to treat it as an actual .ini file even though we're only going to write to it one time and probably never look at it again in code.

<DllImport("kernel32.dll")> _
Private Overloads Shared Function WritePrivateProfileString( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, _
ByVal lpString As String, _
ByVal lpFileName As String) As Integer
End Function

Dim strSystemRoot As String = Environment.ExpandEnvironmentVariables("%SystemRoot%")
Dim oeminfo As New String = strSystemRoot & "\System32\OEMINFO.INI"
WritePrivateProfileString("General", "Manufacturer", "My Company", oeminfo)

In order to generate some WMI code I use Microsoft's WMI Code Creator. You will definately have to tweak the output quite a bit to get what you want, but it works. I find working with WMI in VBS much more straight forward than in VB. I don't know why it has to be this way. Here is a little snippet that queries for a CD\DVD drive:

Try
Dim searcher As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_CDROMDrive")
For Each queryObj As ManagementObject In searcher.Get()
If queryObj("id") = Microsoft.VisualBasic.Left(strSource, 2) Then
MsgBox("Match")
Catch err As ManagementException
MsgBox("An error occurred while querying for WMI data: " & err.Message, MsgBoxStyle.Critical)
End Try

Basically all it does is tell you if your known source (strSource) resides on a CD/DVD vs. a hard disk.

Link to comment
Share on other sites

I re did the script for you and made some changes

Save as MkOem.vbs

Option Explicit
'/->
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
'/->
Dim objFolder, Ts, objFile
Dim ObjWMI, objItem, colItems
Dim dtmDate, dtm
'/->
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sys32 : Sys32 = act.ExpandEnvironmentStrings("%Windir%\System32")
Dim Ini : Ini = "\oeminfo.ini"
Dim strComputer : strComputer = "."
Dim VBS : VBS = Act.ExpandEnvironmentStrings("%SystemDrive%\MkOem.Vbs")
'/->
' Create A New OEM INI
Set Ts = Fso.OpenTextFile(Sys32 & Ini, 2, True)
'/->
' WMI Section
'/->
Set ObjWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "[General]"
Ts.WriteLine "Manufacturer = " & objItem.Manufacturer
Ts.WriteLine "Model = " & objItem.Model
Ts.WriteLine ""
Next
'/----------------------------------------------------------------------->
Ts.WriteLine "[Support Information]"
Ts.WriteLine "Line1= For Technical Support:"
Ts.WriteLine "Line2= to obtain updated drivers or for information on frequently"
Ts.WriteLine "Line3= asked questions, visit the MyCompany technical"
Ts.WriteLine "Line4= support web site at:"
Ts.WriteLine "Line5="
Ts.WriteLine "Line6= http://www.mycompany.com/techsupport."
Ts.WriteLine "Line7="
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line8= OPERATING SYSTEM INFORMATION"
Ts.WriteLine "Line9= Name: " & objItem.Caption
Ts.WriteLine "Line10= Version: " & objItem.Version
Ts.WriteLine "Line11= Install Date: " & WMIDateStringToDate(objItem.InstallDate)
Ts.WriteLine "Line12="
Next
'/----------------------------------------------------------------------->
Function WMIDateStringToDate(dtmDate)
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
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line13= MOTHERBOARD INFORMATION"
Ts.WriteLine "Line14= Manufacturer: " & objItem.Manufacturer
Ts.WriteLine "Line15= Description: " & objItem.Description
Ts.WriteLine "Line16= Model: " & objItem.Model
Ts.WriteLine "Line17= System Type: " & objItem.SystemType
Ts.WriteLine "Line18="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line19= CPU INFORMATION"
Ts.WriteLine "Line20= Manufacturer: " & objItem.Manufacturer
Ts.WriteLine "Line21= Name: " & objItem.Name
Ts.WriteLine "Line22= Description: " & objItem.Description
Ts.WriteLine "Line23= Processor Speed: " & objItem.CurrentClockSpeed & "MHZ"
Ts.WriteLine "Line24= L2 Cache Size: " & objItem.L2CacheSize
Ts.WriteLine "Line25= L2 Cache Speed: " & objItem.L2CacheSpeed & "MHZ"
Ts.WriteLine "Line26="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line27= GRAPHICS CARD INFORMATION"
Ts.WriteLine "Line28= Description: " & objItem.Description
Ts.WriteLine "Line29= Adapter RAM: " & objItem.AdapterRAM
Ts.WriteLine "Line30="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line31= SOUND CARD INFORMATION"
Ts.WriteLine "Line32= Manufacturer: " & objItem.Manufacturer
Ts.WriteLine "Line33= Description: " & objItem.Description
Ts.WriteLine "Line34="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_PnPEntity where ClassGuid = '{4D36E966-E325-11CE-BFC1-08002BE10318}'",,48)
'/----------------------------------------------------------------------->
For Each objItem in colItems
Ts.WriteLine "Line35= HARDWARE ABSTRACTION LAYER INFORMATION"
Ts.WriteLine "Line36= HAL: " & objItem.Name
Ts.WriteLine "Line37="
Next
'/----------------------------------------------------------------------->
Ts.Close
'/-> Run The OEM INI
Act.Run("Notepad.exe " & Sys32 & Ini), 1, True
'/-> Delete The VBS Script If It Exists
If Fso.FileExists(VBS) Then Fso.DeleteFile(VBS) End If

Note

I re did the script on Vista and it reads my Video Card twice, I think that is because my card has a

tv out line. I will test this script later on my XP install later to see if it reports the video card info

the same way.

[General]

Manufacturer = ECS

Model = L7VMM3

[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.

Line7=

Line8= OPERATING SYSTEM INFORMATION

Line9= Name: Microsoft® Windows Vista™ Ultimate

Line10= Version: 6.0.5456

Line11= Install Date: 6/25/2006 10:27:31 AM

Line12=

Line13= MOTHERBOARD INFORMATION

Line14= Manufacturer: ECS

Line15= Description: AT/AT COMPATIBLE

Line16= Model: L7VMM3

Line17= System Type: X86-based PC

Line18=

Line19= CPU INFORMATION

Line20= Manufacturer: AuthenticAMD

Line21= Name: Pro3100A+

Line22= Description: x86 Family 6 Model 8 Stepping 0

Line23= Processor Speed: 1666MHZ

Line24= L2 Cache Size: 256

Line25= L2 Cache Speed: 555MHZ

Line26=

Line27= GRAPHICS CARD INFORMATION

Line28= Description: RADEON 9200 SE Family (Microsoft Corporation - XDDM)

Line29= Adapter RAM: 128

Line30=

Line27= GRAPHICS CARD INFORMATION

Line28= Description: RADEON 9200 SE SEC Family (Microsoft Corporation - XDDM)

Line29= Adapter RAM: 128

Line30=

Line31= SOUND CARD INFORMATION

Line32= Manufacturer: (Generic USB Audio)

Line33= Description: USB Audio Device

Line34=

Line31= SOUND CARD INFORMATION

Line32= Manufacturer: VIA Technologies, Inc.

Line33= Description: VIA AC'97 Enhanced Audio Controller

Line34=

Line35= HARDWARE ABSTRACTION LAYER INFORMATION

Line36= HAL: Advanced Configuration and Power Interface (ACPI) PC

Line37=

Updated MkOem_V6

Edited by gunsmokingman
Link to comment
Share on other sites

Same bug for your sound card.

Here is a fix :

Option Explicit
'/->
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
'/->
Dim objFolder, Ts, objFile
Dim ObjWMI, objItem, colItems
Dim dtmDate, dtm
'/->
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sys32 : Sys32 = act.ExpandEnvironmentStrings("%Windir%\System32")
Dim Ini : Ini = "\oeminfo.ini"
Dim strComputer : strComputer = "."
Dim VBS : VBS = Act.ExpandEnvironmentStrings("%SystemDrive%\MkOem.Vbs")
'/->
' Create A New OEM INI
Set Ts = Fso.OpenTextFile(Sys32 & Ini, 2, True)
Dim LineNbr : LineNbr = 1
Function AddLine(strLine)
Ts.WriteLine "Line" & LineNbr & "=" & strLine
LineNbr = LineNbr + 1
End Function
'/->
' WMI Section
'/->
Set ObjWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "[General]"
Ts.WriteLine "Manufacturer = " & objItem.Manufacturer
Ts.WriteLine "Model = " & objItem.Model
Ts.WriteLine ""
Next
'/----------------------------------------------------------------------->
Ts.WriteLine "[Support Information]"
AddLine " For Technical Support:"
AddLine " to obtain updated drivers or for information on frequently"
AddLine " asked questions, visit the MyCompany technical"
AddLine " support web site at:"
AddLine ""
AddLine " http://www.mycompany.com/techsupport."
AddLine ""
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
AddLine " OPERATING SYSTEM INFORMATION"
AddLine " Name: " & objItem.Caption
AddLine " Version: " & objItem.Version
AddLine " Install Date: " & WMIDateStringToDate(objItem.InstallDate)
AddLine ""
Next
'/----------------------------------------------------------------------->
Function WMIDateStringToDate(dtmDate)
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
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
AddLine " MOTHERBOARD INFORMATION"
AddLine " Manufacturer: " & objItem.Manufacturer
AddLine " Description: " & objItem.Description
AddLine " Model: " & objItem.Model
AddLine " System Type: " & objItem.SystemType
AddLine ""
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
AddLine " CPU INFORMATION"
AddLine " Manufacturer: " & objItem.Manufacturer
AddLine " Name: " & objItem.Name
AddLine " Description: " & objItem.Description
AddLine " Processor Speed: " & objItem.CurrentClockSpeed & "MHZ"
AddLine " L2 Cache Size: " & objItem.L2CacheSize
AddLine " L2 Cache Speed: " & objItem.L2CacheSpeed & "MHZ"
AddLine ""
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
AddLine " GRAPHICS CARD INFORMATION"
AddLine " Description: " & objItem.Description
AddLine " Adapter RAM: " & objItem.AdapterRAM
AddLine ""
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
AddLine " SOUND CARD INFORMATION"
AddLine " Manufacturer: " & objItem.Manufacturer
AddLine " Description: " & objItem.Description
AddLine ""
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_PnPEntity where ClassGuid = '{4D36E966-E325-11CE-BFC1-08002BE10318}'",,48)
'/----------------------------------------------------------------------->
For Each objItem in colItems
AddLine " HARDWARE ABSTRACTION LAYER INFORMATION"
AddLine " HAL: " & objItem.Name
AddLine ""
Next
'/----------------------------------------------------------------------->
Ts.Close
'/-> Run The OEM INI
Act.Run("Notepad.exe " & Sys32 & Ini), 1, True
'/-> Delete The VBS Script If It Exists
' If Fso.FileExists(VBS) Then Fso.DeleteFile(VBS) End If

++

Link to comment
Share on other sites

@ Delprat & gunsmokingman

List installed hotfixes.

Is it possible to add this funktion in your scripts?

Like in this cmd.

cmdow @ /HID
@ECHO OFF
SET D=%SYSTEMROOT%\system32\
REM delete oeminfo.ini if exists
if exist "%D%oeminfo.ini" del "%D%oeminfo.ini" /q
FOR %%d IN (c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:) DO IF EXIST %%d\WIN51IP SET CDROM=%%d


echo [General] >> "%D%oeminfo.ini"
echo Manufacturer=Unattendet Win. XP sp2 Pro >> "%D%oeminfo.ini"
echo Model=Slim Slipstream Version >> "%D%oeminfo.ini"
echo [Support Information] >> "%D%oeminfo.ini"
echo Line1=Dato for installation: %date% >> "%D%oeminfo.ini"
echo Line2= >> "%D%oeminfo.ini"
echo Line3=Slipstreamed Hotfix:>> "%D%oeminfo.ini"
echo Line4= >> "%D%oeminfo.ini"

REM Line Number
SET i=5

REM List quickfixes without exe extension
For /F "TOKENS=1 delims=.exe" %%j in ( 'dir /B %CDROM%\I386\svcpack\KB*.exe' )do ( ( set kbname=%%j ) & (call :myprint) )
GOTO :EOF

:myprint
echo Line%i%=%kbname% >> "%D%oeminfo.ini"
SET /A i+=1

:EOF

Link to comment
Share on other sites

I really do not know, I just re wrote kev_147.

Your script would not work with mine as it 2 different langauges.

I would use something like this if it can be added to the OEM.ini

StrComputer = "."
Dim KbInfo, ObjKbHta, objQuickFix, colQuickFixes, RptKB, RptHta, RP_1, RP_2, Uptotal : Uptotal = 0
Set ObjWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & StrComputer & "\root\cimv2")
Set colQuickFixes = ObjWMI.ExecQuery("Select * from Win32_QuickFixEngineering")
If colQuickFixes.Count = 0 Then
WScript.Echo "No Installed updates"
End If
For Each objQuickFix in colQuickFixes
RP_1 = objQuickFix.Description
If InStr(RP_1,"Windows") Then
Uptotal = Uptotal + 1
RP_2 = Replace(RP_1,"Security Update for Windows Media Player 10","Security Update For WMP10")
RptKB = RP_2
RptHta = RptHta & "Name  " & objQuickFix.HotFixID
WScript.Echo RptHta
End If
Next

Link to comment
Share on other sites

I have redid the above script to this

Save as ListUpdates.vbs

StrComputer = "."
Dim objQuickFix, RP_1, RP_2, RP_3, RP_4, Ts
Dim Uptotal : Uptotal = 0
Dim ObjWMI : Set ObjWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & StrComputer & "\root\cimv2")
Dim colQuickFixes : Set colQuickFixes = ObjWMI.ExecQuery("Select * from Win32_QuickFixEngineering")
Dim Act : Set Act = CreateObject("Wscript.shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim DTop : DTop = Act.SpecialFolders("Desktop")
Dim UpReport : UpReport = DTop & "\InstalledUpdates.txt"
If colQuickFixes.Count = 0 Then
WScript.Echo "No Installed updates"
End If
Set Ts = Fso.CreateTextFile(UpReport)
Ts.WriteLine Space(3) & Now()
For Each objQuickFix in colQuickFixes
RP_1 = objQuickFix.Description
RP_2 = objQuickFix.HotFixID
RP_3 = objQuickFix.InstalledOn
RP_4 = objQuickFix.InstalledBy
If InStr(RP_1,"Windows") Then
If Uptotal < 9 Then
Uptotal = "0" & Uptotal + 1
Ts.WriteLine Space(1) & Chr(187) & Space(1) & Uptotal & "\ " & RP_1 & vbCrLf & _
" Name : " & RP_2 & vbCrLf &_
" Installed Date : " & RP_3 & vbCrLf &_
objQuickFix.InstalledBy & vbCrLf
Else
Uptotal = Uptotal + 1
Ts.WriteLine Space(1) & Chr(187) & Space(1) & Uptotal & "\ " & RP_1 & vbCrLf & _
" Name : " & RP_2 & vbCrLf &_
" Installed Date : " & RP_3 & vbCrLf &_
" Installed By : " & RP_4 & vbCrLf
End If
End If
Next
Ts.Close
Act.Run("Notepad.exe " & UpReport)

Link to comment
Share on other sites

GSM don't worry about updating anything I have done, your scripting skills are a hell of a lot better than mine. I am sorry I can't post as much as I would like, but I am snowed under at work and the oeminfo script was a minor thing I needed. I now need to sort out some more important things with my UA install.

Link to comment
Share on other sites

  • 1 month later...

I have updated the script so it only list one Sound And One Video Card

Save As MkOem_v2.Vbs

Option Explicit
'/->
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
'/->
Dim objFolder, Ts, objFile
Dim ObjWMI, objItem, colItems
Dim dtmDate, dtm
'/->
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sys32 : Sys32 = act.ExpandEnvironmentStrings("%Windir%\System32")
Dim Ini : Ini = "\oeminfo.ini"
Dim strComputer : strComputer = "."
Dim VBS : VBS = Act.ExpandEnvironmentStrings("%SystemDrive%\MkOem_v2.Vbs")
'/->
Dim MB : MB = 1024 * 1024
Dim S_3 : S_3 = Space(3)
Dim S_5 : S_5 = Space(5)
Dim TitleL : TitleL = S_5 & Chr(171) & S_3
Dim TitleR : TitleR = S_3 & Chr(187) & S_5
Dim Cnt
'/->
Set Ts = Fso.OpenTextFile(Sys32 & Ini, 2, True)
'/->
' WMI Section
'/->
Set ObjWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "[General]"
Ts.WriteLine "Manufacturer = " & objItem.Manufacturer
Ts.WriteLine "Model Type = " & objItem.Model
Ts.WriteLine ""
Next
'/----------------------------------------------------------------------->
Ts.WriteLine "[Support Information]"
Ts.WriteLine "Line1= For Technical Support:"
Ts.WriteLine "Line2= to obtain updated drivers or for information on frequently"
Ts.WriteLine "Line3= asked questions, visit the MyCompany technical"
Ts.WriteLine "Line4= support web site at:"
Ts.WriteLine "Line5="
Ts.WriteLine "Line6= http://www.mycompany.com/techsupport."
Ts.WriteLine "Line7="
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line8= " & TitleL & "OPERATING SYSTEM INFORMATION" & TitleR
Ts.WriteLine "Line9= " & S_3 & "OS Name " & vbTab & objItem.Caption
Ts.WriteLine "Line10=" & S_3 & "OS Version " & vbTab & objItem.Version
Ts.WriteLine "Line11=" & S_3 & "Install Date " & vbTab & WMIDateStringToDate(objItem.InstallDate)
Ts.WriteLine "Line12=" & S_3 & "Computer Name " & vbTab & objItem.CSName
Ts.WriteLine "Line13=" & S_3 & "Organization " & vbTab & objItem.Organization
Ts.WriteLine "Line14="
Next
'/----------------------------------------------------------------------->
Function WMIDateStringToDate(dtmDate)
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
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line15=" & TitleL & "MOTHERBOARD INFORMATION" & TitleR
Ts.WriteLine "Line16=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line17=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line18=" & S_3 & "Model Type " & vbTab & objItem.Model
Ts.WriteLine "Line19=" & S_3 & "System Type " & vbTab & objItem.SystemType
Ts.WriteLine "Line20="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line21=" & TitleL & "CPU INFORMATION" & TitleR
Ts.WriteLine "Line22=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line23=" & S_3 & "CPU Name " & vbTab & objItem.Name
Ts.WriteLine "Line24=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line25=" & S_3 & "Processor Speed " & vbTab & objItem.CurrentClockSpeed & " MHZ"
Ts.WriteLine "Line26=" & S_3 & "L2 Cache Size " & vbTab & objItem.L2CacheSize
Ts.WriteLine "Line27=" & S_3 & "L2 Cache Speed " & vbTab & objItem.L2CacheSpeed & " MHZ"
Ts.WriteLine "Line28="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Cnt = Cnt + 1
If Cnt = 1 Then
Ts.WriteLine "Line29=" & TitleL & "GRAPHICS CARD INFORMATION" & TitleR
Ts.WriteLine "Line30=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line31=" & S_3 & "Driver Version " & vbTab & objItem.DriverVersion
Ts.WriteLine "Line32=" & S_3 & "Adapter RAM " & vbTab & objItem.AdapterRAM /MB & " MB"
Ts.WriteLine "Line33=" & S_3 & "Adapter DAC Type " & vbTab & objItem.AdapterDACType
Ts.WriteLine "Line34="
End If
Next
'/-> Reset Cnt To Zero
Cnt = 0
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
If InStr(objItem.DeviceID, "PCI") Then
Ts.WriteLine "Line35=" & TitleL & "SOUND CARD INFORMATION" & TitleR
Ts.WriteLine "Line36=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line37=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line38="
End If
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_PnPEntity where ClassGuid = '{4D36E966-E325-11CE-BFC1-08002BE10318}'",,48)
'/----------------------------------------------------------------------->
For Each objItem in colItems
Ts.WriteLine "Line39=" & TitleL & "HARDWARE ABSTRACTION LAYER INFORMATION" & TitleR
Ts.WriteLine "Line40=" & S_3 & "HAL Details " & vbTab & objItem.Name
Ts.WriteLine "Line41="
Next
'/----------------------------------------------------------------------->
Ts.Close
Act.Run("Notepad.exe " & Sys32 & Ini)
If Fso.FileExists(VBS) Then Fso.DeleteFile(VBS) End If

This is how the new script makes OemInfo.ini

[General]
Manufacturer = ECS
Model Type = L7VMM3

[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.
Line7=
Line8= « OPERATING SYSTEM INFORMATION »
Line9= OS Name Microsoft Windows XP Professional
Line10= OS Version 5.1.2600
Line11= Install Date 2/27/2006 2:18:38 AM
Line12= Computer Name BETA-HOME-ON_C
Line13= Organization Home-Beta-2004
Line14=
Line15= « MOTHERBOARD INFORMATION »
Line16= Manufacturer ECS
Line17= Description AT/AT COMPATIBLE
Line18= Model Type L7VMM3
Line19= System Type X86-based PC
Line20=
Line21= « CPU INFORMATION »
Line22= Manufacturer AuthenticAMD
Line23= CPU Name AMD Athlon(tm) XP 2000+
Line24= Description x86 Family 6 Model 8 Stepping 0
Line25= Processor Speed 1672 MHZ
Line26= L2 Cache Size 256
Line27= L2 Cache Speed 557 MHZ
Line28=
Line29= « GRAPHICS CARD INFORMATION »
Line30= Description RADEON 9200 SE Family (Microsoft Corporation)
Line31= Driver Version 6.14.10.6462
Line32= Adapter RAM 128 MB
Line33= Adapter DAC Type Internal DAC(500MHz)
Line34=
Line35= « SOUND CARD INFORMATION »
Line36= Manufacturer VIA Technologies, Inc.
Line37= Description Vinyl AC'97 Codec Combo Driver (WDM)
Line38=
Line39= « HARDWARE ABSTRACTION LAYER INFORMATION »
Line40= HAL Details Advanced Configuration and Power Interface (ACPI) PC
Line41=

Updated MkOem_V6

Edited by gunsmokingman
Link to comment
Share on other sites

Here I added Network Card And Ip address to this script

Save As MkOem_v3.Vbs

Option Explicit
'/->
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
'/->
Dim objFolder, Ts, objFile
Dim ObjWMI, objItem, colItems
Dim dtmDate, dtm
Dim Cnt, i, IP
'/->
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Sys32 : Sys32 = act.ExpandEnvironmentStrings("%Windir%\System32")
Dim Ini : Ini = "\oeminfo.ini"
Dim strComputer : strComputer = "."
Dim VBS : VBS = Act.ExpandEnvironmentStrings("%SystemDrive%\MkOem_v3.Vbs")
'/->
Dim MB : MB = 1024 * 1024
Dim S_3 : S_3 = Space(3)
Dim S_5 : S_5 = Space(5)
Dim TitleL : TitleL = S_5 & Chr(171) & S_3
Dim TitleR : TitleR = S_3 & Chr(187) & S_5
'/->
Set Ts = Fso.OpenTextFile(Sys32 & Ini, 2, True)
'/->
' WMI Section
'/->
Set ObjWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "[General]"
Ts.WriteLine "Manufacturer = " & objItem.Manufacturer
Ts.WriteLine "Model Type = " & objItem.Model
Ts.WriteLine ""
Next
'/----------------------------------------------------------------------->
Ts.WriteLine "[Support Information]"
Ts.WriteLine "Line1= For Technical Support:"
Ts.WriteLine "Line2= to obtain updated drivers or for information on frequently"
Ts.WriteLine "Line3= asked questions, visit the MyCompany technical"
Ts.WriteLine "Line4= support web site at:"
Ts.WriteLine "Line5="
Ts.WriteLine "Line6= http://www.mycompany.com/techsupport."
Ts.WriteLine "Line7="
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line8= " & TitleL & "OPERATING SYSTEM INFORMATION" & TitleR
Ts.WriteLine "Line9= " & S_3 & "OS Name " & vbTab & objItem.Caption
Ts.WriteLine "Line10=" & S_3 & "OS Version " & vbTab & objItem.Version
Ts.WriteLine "Line11=" & S_3 & "Install Date " & vbTab & WMIDateStringToDate(objItem.InstallDate)
Ts.WriteLine "Line12=" & S_3 & "Computer Name " & vbTab & objItem.CSName
Ts.WriteLine "Line13=" & S_3 & "Organization " & vbTab & objItem.Organization
Ts.WriteLine "Line14="
Next
'/----------------------------------------------------------------------->
Function WMIDateStringToDate(dtmDate)
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
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line15=" & TitleL & "MOTHERBOARD INFORMATION" & TitleR
Ts.WriteLine "Line16=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line17=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line18=" & S_3 & "Model Type " & vbTab & objItem.Model
Ts.WriteLine "Line19=" & S_3 & "System Type " & vbTab & objItem.SystemType
Ts.WriteLine "Line20="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Ts.WriteLine "Line21=" & TitleL & "CPU INFORMATION" & TitleR
Ts.WriteLine "Line22=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line23=" & S_3 & "CPU Name " & vbTab & objItem.Name
Ts.WriteLine "Line24=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line25=" & S_3 & "Processor Speed " & vbTab & objItem.CurrentClockSpeed & " MHZ"
Ts.WriteLine "Line26=" & S_3 & "L2 Cache Size " & vbTab & objItem.L2CacheSize
Ts.WriteLine "Line27=" & S_3 & "L2 Cache Speed " & vbTab & objItem.L2CacheSpeed & " MHZ"
Ts.WriteLine "Line28="
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
Cnt = Cnt + 1
If Cnt = 1 Then
Ts.WriteLine "Line29=" & TitleL & "GRAPHICS CARD INFORMATION" & TitleR
Ts.WriteLine "Line30=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line31=" & S_3 & "Driver Version " & vbTab & objItem.DriverVersion
Ts.WriteLine "Line32=" & S_3 & "Adapter RAM " & vbTab & objItem.AdapterRAM /MB & " MB"
Ts.WriteLine "Line33=" & S_3 & "Adapter DAC Type " & vbTab & objItem.AdapterDACType
Ts.WriteLine "Line34="
End If
Next
'/-> Reset Cnt To Zero
Cnt = 0
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
For Each objItem In colItems
If InStr(objItem.DeviceID, "PCI") Then
Ts.WriteLine "Line35=" & TitleL & "SOUND CARD INFORMATION" & TitleR
Ts.WriteLine "Line36=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line37=" & S_3 & "Description " & vbTab & objItem.Description
Ts.WriteLine "Line38="
End If
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery ("Select IPAddress from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
'/----------------------------------------------------------------------->
For Each objItem in colItems
If Not IsNull(objItem.IPAddress) Then
For i=LBound(objItem.IPAddress) To UBound(objItem.IPAddress)
IP = objItem.IPAddress(i)
Next
End If
Next
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
'/----------------------------------------------------------------------->
Cnt = 1
For Each objItem in colItems
If Cnt = 1 Then
Ts.WriteLine "Line39=" & TitleL & "NETWORK ADAPTER INFORMATION" & TitleR
Ts.WriteLine "Line40=" & S_3 & "Name " & vbTab & objItem.Name
Ts.WriteLine "Line41=" & S_3 & "Manufacturer " & vbTab & objItem.Manufacturer
Ts.WriteLine "Line42=" & S_3 & "IP Address " & vbTab & IP
Ts.WriteLine "Line43="
Exit For
End If
Next
Cnt = 0
'/----------------------------------------------------------------------->
Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_PnPEntity where ClassGuid = '{4D36E966-E325-11CE-BFC1-08002BE10318}'",,48)
'/----------------------------------------------------------------------->
For Each objItem in colItems
Ts.WriteLine "Line44=" & TitleL & "HARDWARE ABSTRACTION LAYER INFORMATION" & TitleR
Ts.WriteLine "Line45=" & S_3 & "HAL Details " & vbTab & objItem.Name
Ts.WriteLine "Line46="
Next
'/----------------------------------------------------------------------->
Ts.Close
Act.Run("Notepad.exe " & Sys32 & Ini)
If Fso.FileExists(VBS) Then Fso.DeleteFile(VBS) End If

Updated MkOem_V6

Edited by gunsmokingman
Link to comment
Share on other sites

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...