Help - Search - Members - Calendar
Full Version: Automatic creation of oeminfo.ini
MSFN Forums > Coding, Scripting and Servers > Programming (C++, Delphi, VB, etc.)

   
Google Internet Forums Unattended CD/DVD Guide
kev_147
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.gif / thumbup.gif
RogueSpear
I actually started to put code together in VB2005 to do this. It's really nothing more than writing a standard text file with the values you get from WMI (or other) queries.
kev_147
Can you point me in the direction of doing this please
RogueSpear
If you're looking to use VB, you'd write a line something like this:
CODE
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.
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:
CODE
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.
kev_147
Thanks for the reply m8.

I have just spent a couple of hours creating the attached VBScript. Will post it up as may be of some use to people. What do you think? Any feedback appreciated.
gunsmokingman
I re did the script for you and made some changes
Save as MkOem.vbs
QUOTE
CODE
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.
QUOTE
[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
Delprat
Same bug for your sound card.

Here is a fix :
CODE
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


++
gunsmokingman
Did not even notice that thanks. Vista seems to be reporting my mic I have for the web camera I have.
Lau
@ Delprat & gunsmokingman

List installed hotfixes.
Is it possible to add this funktion in your scripts?

Like in this cmd.
CODE
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
gunsmokingman
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
QUOTE
CODE
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
gunsmokingman
I have redid the above script to this
Save as ListUpdates.vbs
QUOTE
CODE
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)
kev_147
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.
gunsmokingman
I have updated the script so it only list one Sound And One Video Card
Save As MkOem_v2.Vbs
QUOTE
CODE
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
QUOTE
CODE
[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
kev_147
can it also list the network card, but only the ethernet card?

great work btw gsh
gunsmokingman
Here I added Network Card And Ip address to this script
Save As MkOem_v3.Vbs
QUOTE
CODE
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
kev_147
looking really good gsh. Should of asked this before, but is there a way to add details of the HDD as well, then it is near enough a full hardware audit in 1 place. eg easy for an engineer to see what is installed within the PC.

Might also be worth adding the info for system type. ie Laptop or Desktop.

What do you reckon? Possible?
gunsmokingman
I will look into that for you.
gunsmokingman
I have added a basic list drives to the script
What It Makes
QUOTE
CODE
[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=     «   NETWORK ADAPTER INFORMATION   »    
Line40=   Name             VIA Rhine II Fast Ethernet Adapter
Line41=   Manufacturer     VIA Technologies, Inc.
Line42=   IP Address       206.116.20.121
Line43=
Line44=     «   HARDWARE ABSTRACTION LAYER INFORMATION   »    
Line45=   HAL DETAILS
Line46=   Advanced Configuration and Power Interface (ACPI) PC
Line47=
Line48=     «   FLOPPY CD_DvD HARDDRIVE INFORMATION   »    
Line49=   FloppyDisk      A:\
Line50=   Hard Drive      C:\    Disk Size  »  13.13 GB
Line51=   Hard Drive      D:\    Disk Size  »  25.93 GB
Line52=   Hard Drive      E:\    Disk Size  »  37.24 GB
Line53=   Hard Drive      F:\    Disk Size  »  12.45 GB
Line54=   Hard Drive      G:\    Disk Size  »  12.68 GB
Line55=   Hard Drive      H:\    Disk Size  »  23.97 GB
Line56=   Hard Drive      I:\    Disk Size  »  24.65 GB
Line57=   CD_DVD Drive    J:\
Line58=   CD_DVD Drive    L:\


Save As MkOem_v4.Vbs
QUOTE
CODE
'/-> Script By Gunsmokingman
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_v4.Vbs")
'/->
  Dim MB          : MB = 1024 * 1024
  Dim GB          : GB = 1024 * 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 WmiVar      : WmiVar = wbemFlagReturnImmediately + wbemFlagForwardOnly
'/->
   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", WmiVar)
'/----------------------------------------------------------------------->
    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", WmiVar)
'/----------------------------------------------------------------------->
    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
'/----------------------------------------------------------------------->
   Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", WmiVar)
'/----------------------------------------------------------------------->
    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", WmiVar)
'/----------------------------------------------------------------------->
    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", WmiVar)
'/----------------------------------------------------------------------->
    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", WmiVar)
'/----------------------------------------------------------------------->
    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", WmiVar)
'/----------------------------------------------------------------------->
  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 "
     Ts.WriteLine "Line46=" & S_3 & objItem.Name
     Ts.WriteLine "Line47="
    Next
'/----------------------------------------------------------------------->
   Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_LogicalDisk", "WQL", WmiVar)
'/----------------------------------------------------------------------->
Dim DrvType, Rpt
     Ts.WriteLine "Line48=" & TitleL & "FLOPPY CD_DvD HARDDRIVE INFORMATION" & TitleR
    For Each objItem in colItems
     DrvType = objItem.MediaType
     Cnt = Cnt + 1
     CheckDrvType()
      If Cnt = 1 Then Ts.WriteLine "Line49=" & Rpt End If
      If Cnt = 2 Then Ts.WriteLine "Line50=" & Rpt End If
      If Cnt = 3 Then Ts.WriteLine "Line51=" & Rpt End If
      If Cnt = 4 Then Ts.WriteLine "Line52=" & Rpt  End If
      If Cnt = 5 Then Ts.WriteLine "Line53=" & Rpt  End If
      If Cnt = 6 Then Ts.WriteLine "Line54=" & Rpt  End If
      If Cnt = 7 Then Ts.WriteLine "Line55=" & Rpt  End If
      If Cnt = 8 Then Ts.WriteLine "Line56=" & Rpt  End If
      If Cnt = 9 Then Ts.WriteLine "Line57=" & Rpt  End If
      If Cnt = 10 Then Ts.WriteLine "Line58=" & Rpt  End If
      If Cnt = 11 Then Ts.WriteLine "Line59=" & Rpt  End If
      If Cnt = 12 Then Ts.WriteLine "Line60=" & Rpt  End If
      If Cnt = 13 Then Ts.WriteLine "Line61=" & Rpt  End If
      If Cnt = 14 Then Ts.WriteLine "Line62=" & Rpt  End If
      If Cnt = 15 Then Ts.WriteLine "Line63=" & Rpt  End If
      If Cnt = 16 Then Ts.WriteLine "Line64=" & Rpt  End If
      If Cnt = 17 Then Ts.WriteLine "Line65=" & Rpt  End If
      If Cnt = 18 Then Ts.WriteLine "Line66=" & Rpt  End If
      If Cnt = 19 Then Ts.WriteLine "Line67=" & Rpt  End If
      If Cnt = 20 Then Ts.WriteLine "Line68=" & Rpt  End If
      If Cnt = 21 Then Ts.WriteLine "Line69=" & Rpt  End If
      If Cnt = 22 Then Ts.WriteLine "Line70=" & Rpt  End If
      If Cnt = 23 Then Ts.WriteLine "Line71=" & Rpt  End If
      If Cnt = 24 Then Ts.WriteLine "Line72=" & Rpt  End If
      If Cnt = 25 Then Ts.WriteLine "Line73=" & Rpt  End If
      If Cnt = 26 Then Ts.WriteLine "Line74=" & Rpt  End If
     Rpt = ""
    Next  
   Cnt = 0  
'/----------------------------------------------------------------------->
   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    
'/----------------------------------------------------------------------->
   Function CheckDrvType()
'/-> Floppy Disk Check
    If DrvType = 5 then
       Rpt = S_3 &  "FloppyDisk " & vbTab & objItem.Name & "\"
    End  If
'/-> CD Or DVD Check
    If DrvType = 11 Then
       Rpt = S_3 &  "CD_DVD Drive " & vbTab & objItem.Name & "\"
    End  If  
'/-> Hard Drive Check
    If DrvType = 12 Then
     Rpt = S_3 &  "Hard Drive  " & vbTab & objItem.Name & "\" & vbTab & "Disk Size" & Space(2) &_
     Chr(187) & Space(2) & (Left(Round(objItem.Size /GB, 5),5)) & " GB"
    End  If
   End Function  
'/----------------------------------------------------------------------->
   Ts.Close
   Act.Run("Notepad.exe " & Sys32 & Ini)
   If Fso.FileExists(VBS) Then Fso.DeleteFile(VBS) End If

Updated MkOem_V6
kev_147
GSH, thanks for all your help on this. I think it is a pretty neat and very useful script now.

I have just incorporated it into my automated install of Windows XP.
gunsmokingman
QUOTE (kev_147 @ Aug 29 2006, 03:09 PM) *
GSH, thanks for all your help on this. I think it is a pretty neat and very useful script now.

I have just incorporated it into my automated install of Windows XP.

Thank you for the idea I hope you like what it produces now.
It also GSM and not GSH biggrin.gif
kev_147
Oh yeah, sorry m8, was probably half asleep.
oioldman
this is quality and makes me wish i could find time to learn vbs a seems to be a very useful tool

[edit
just applied this and the Support Information button doesn't report everything that i see in the actual .ini file.
Is this just me? am thinking that maybe it has a display of information limit
[/edit]
gunsmokingman
I get 2 different results running the script on 2 different computers.
On my AMD it reports every thing in the support button but on a older
P3 the ini is made but the support button is not added. I do not know
why this happens.
oioldman
bizarre!
if you want to investigate further, i can send/upload the oeminfo.ini file, but as it does capture all i can just use that.

thanks again

P.S do you run this as part of an unattended install? and if so, when do you apply it.
swgreed
A very nice script that actually puts some real useful stuff in the support information biggrin.gif
Also fits very well into the unattended section

Further Information for your editing pleasure:

http://msdn2.microsoft.com/en-us/library/ms811550.aspx
BazookaJoe
QUOTE (gunsmokingman @ Aug 29 2006, 02:05 PM) *
QUOTE (kev_147 @ Aug 29 2006, 03:09 PM) *
GSH, thanks for all your help on this. I think it is a pretty neat and very useful script now.

I have just incorporated it into my automated install of Windows XP.

Thank you for the idea I hope you like what it produces now.
It also GSM and not GSH biggrin.gif


I appreciate the significant effort you've put into this tool, but maybe I could ask for a bit more? Let me explain.

I am developing a hardware agnostic image for use in the corp environment. We have a lot of different flavors of hardware, and it would be very useful to have a script like this that could be executed from cmdlines / guirunonce during minisetup or first boot to autodetect the PC Manufacturer, model, serial #, & BIOS rev level, and then output it to winnt/system32 to overwrite the default oeminfo.ini file. I'd like to be able to do this with no manual interaction.

Perhaps you could modularize your script so that users could invoke only the parts of the script that they need? That way, I could get what I'm asking for, omit the extraneous stuff i'm not interested in, and i'd think this would make it easier for you add / remove functionality to your script without having to do major code revisions?

I'd do this myself, but my scripting skills are remedial at best. Thanks in advance for any help you can provide.
gunsmokingman
QUOTE (BazookaJoe @ Sep 28 2007, 04:43 PM) *
QUOTE (gunsmokingman @ Aug 29 2006, 02:05 PM) *
QUOTE (kev_147 @ Aug 29 2006, 03:09 PM) *
GSH, thanks for all your help on this. I think it is a pretty neat and very useful script now.

I have just incorporated it into my automated install of Windows XP.

Thank you for the idea I hope you like what it produces now.
It also GSM and not GSH biggrin.gif


I appreciate the significant effort you've put into this tool, but maybe I could ask for a bit more? Let me explain.

I am developing a hardware agnostic image for use in the corp environment. We have a lot of different flavors of hardware, and it would be very useful to have a script like this that could be executed from cmdlines / guirunonce during minisetup or first boot to autodetect the PC Manufacturer, model, serial #, & BIOS rev level, and then output it to winnt/system32 to overwrite the default oeminfo.ini file. I'd like to be able to do this with no manual interaction.

Perhaps you could modularize your script so that users could invoke only the parts of the script that they need? That way, I could get what I'm asking for, omit the extraneous stuff i'm not interested in, and i'd think this would make it easier for you add / remove functionality to your script without having to do major code revisions?

I'd do this myself, but my scripting skills are remedial at best. Thanks in advance for any help you can provide.


1:\ I am not sure that Wmi works at the cmdline part of a install.
2:\ This script produces a new oeminfo.ini.
If you want I could make you a custom script to produce what you want. Post what you need for the oeminfo,
I will then redo the script with what you need.

Edit
I have made some changes to the script so here is the updated SFX

Updated MkOem_V6
swgreed
CODE
... objItem.PCSystemType = 0 Then PCType = "Unspecified" ...


seems to be valid in VISTA only... (gives an errormessage in XP)
JuMz
Vista has a new way to do Oeminfo etc. It's all through the registry now...Does this sfx work for Vista as well?


EDIT: I get the same error on XP as mentioned above.
gunsmokingman
QUOTE (JuMz @ May 2 2008, 04:30 PM) *
Vista has a new way to do Oeminfo etc. It's all through the registry now...Does this sfx work for Vista as well?


EDIT: I get the same error on XP as mentioned above.


I wrote this script on Vista, when I get a chance to install XP I will re do the script so it will work on XP.

`Felix`
QUOTE (gunsmokingman @ May 3 2008, 09:45 PM) *
QUOTE (JuMz @ May 2 2008, 04:30 PM) *
Vista has a new way to do Oeminfo etc. It's all through the registry now...Does this sfx work for Vista as well?


EDIT: I get the same error on XP as mentioned above.


I wrote this script on Vista, when I get a chance to install XP I will re do the script so it will work on XP.




Hi there,

Have you had a chance to check the script on XP? Also something i have noticed when testing WMI queries on OEM systems is that by extracting model and manufacturer from Win32_ComputerSystem will often give unwanted results... from example if i check a gigabyte motherboard based system i get - Model: AWRDACPI and Manufacturer: GBT___ however if i query Win32_BaseBoard i get Model: 965P-S3 and Manufacturer: Gigabyte Technology Co., Ltd. which is correct. I have done the same tests on a dell and using the Win32_BaseBoard seems to give the best results for these 2 specific fields.

Look forward to your XP based version...

PS the only issue with v5 script is the PCSystemType Section - i have had a look using WMI Code creator and it appears that XP has SystemType not PCSystemType (seems to be new with Vista). so if you change:

CODE
      If objItem.CSystemType = 0 Then PCType = "Unspecified"
          If objItem.PCSystemType = 1 Then PCType = "Desktop"
          If objItem.PCSystemType = 2 Then PCType = "Mobile"
          If objItem.PCSystemType = 3 Then PCType = "Work Station"
          If objItem.PCSystemType = 4 Then PCType = "Enterprise Server"
          If objItem.PCSystemType = 5 Then PCType = "Small Office and Home Office (SOHO) Server"
          If objItem.PCSystemType = 6 Then PCType = "Appliance PC"
          If objItem.PCSystemType = 7 Then PCType = "Performance Server"
          If objItem.PCSystemType = 8 Then PCType = "Maximum"


to

CODE
PCType = objItem.SystemType


This provides a simple work around until you get a change to update the code in a better way... (am a novice and am just experimenting smile.gif )

Update: I am working on an updated version at the moment using all the nice code that you have worked so hard on and adding some other things. Will be testing on Windows XP, Vista and 2003. I am hoping to have a version that will run on all. Hope to have something up here in the next few days - have been having to teach myself VBScript as i go smile.gif

Cheers,
Darren
gunsmokingman
I have made some changes so it should run on XP I
1:\ Made some changes to the network adapter output
2:\ Made changes to the mother board output

QUOTE
CODE
'/-> Script By Gunsmokingman
Option Explicit
'/->
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
'/->
  Dim objFolder, Ts, objFile
  Dim ObjWMI, objItem, colItems
  Dim dtmDate, dtm
  Dim C1, 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("%Temp%\" & Fso.GetFile(WScript.ScriptFullName).Name)
'/->
  Dim MB          : MB = 1024 * 1024
  Dim GB          : GB = 1024 * 1024 * 1024
  Dim Line        : Line = "Line" & C1
  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 WmiVar      : WmiVar = wbemFlagReturnImmediately + wbemFlagForwardOnly
'/->
   Set Ts = Fso.OpenTextFile(Sys32 & Ini, 2, True)
'/->
' WMI Section
'/->
   Set ObjWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
'/->
' Check For What OS This Is Running On
'/->
  Dim Os_Name
   Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", WmiVar)  
   For Each objItem In colItems
    Os_Name = objItem.Caption
   Next
'/->
' Separate The Output For Either XP Or Vita
'/->
  Dim PCType, RamTotal
     Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", WmiVar)
'/-> Vista
    If Instr(LCase(Os_Name),"vista") Then
    For Each objItem In colItems
     RamTotal = FormatNumber(objItem.TotalPhysicalMemory/1048576) & " MB"
      If objItem.PCSystemType = 0 Then PCType = "Unspecified"
      If objItem.PCSystemType = 1 Then PCType = "Desktop"
      If objItem.PCSystemType = 2 Then PCType = "Mobile"
      If objItem.PCSystemType = 3 Then PCType = "Work Station"
      If objItem.PCSystemType = 4 Then PCType = "Enterprise Server"
      If objItem.PCSystemType = 5 Then PCType = "Small Office and Home Office (SOHO) Server"
      If objItem.PCSystemType = 6 Then PCType = "Appliance PC"
      If objItem.PCSystemType = 7 Then PCType = "Performance Server"
      If objItem.PCSystemType = 8 Then PCType = "Maximum"
     Ts.WriteLine "[General]"
     Ts.WriteLine "Manufacturer = " & objItem.Manufacturer
     Ts.WriteLine "Model Type   = " & objItem.Model
     Ts.WriteLine ""
    Next
    End If
'/-> XP
   Dim XpType
    If Instr(LCase(Os_Name),"xp") Then
    For Each objItem In colItems
    XpType = objItem.SystemType
     RamTotal = FormatNumber(objItem.TotalPhysicalMemory/1048576) & " MB"
     Ts.WriteLine "[General]"
     Ts.WriteLine "Manufacturer = " & objItem.Manufacturer
     Ts.WriteLine "Model Type   = " & objItem.Model
     Ts.WriteLine ""
    Next
    End If
'/----------------------------------------------------------------------->
     Ts.WriteLine "[Support Information]"
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "= For Technical Support:"
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "= to obtain updated drivers or for information on frequently"
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "= asked questions, visit the MyCompany technical"
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "= support web site at:"
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "="
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "= http://www.mycompany.com/techsupport."
      C1 = C1 +1
     Ts.WriteLine "Line" & C1 & "="
'/----------------------------------------------------------------------->
   Set colItems = ObjWMI.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", WmiVar)
'/----------------------------------------------------------------------->
   &nb