<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Richard Smith : BDD2.5</title><link>http://blogs.technet.com/richardsmith/archive/tags/BDD2.5/default.aspx</link><description>Tags: BDD2.5</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WMI Tags for Task Sequencer Logic</title><link>http://blogs.technet.com/richardsmith/archive/2007/08/01/wmi-tags-for-task-sequencer-logic.aspx</link><pubDate>Wed, 01 Aug 2007 17:42:00 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:1672072</guid><dc:creator>ricsmith</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.technet.com/richardsmith/comments/1672072.aspx</comments><wfw:commentRss>http://blogs.technet.com/richardsmith/commentrss.aspx?PostID=1672072</wfw:commentRss><description>&lt;P&gt;One of the things that I&amp;nbsp;am often required to obtain for customers are&amp;nbsp;certain WMI tags so that we can write task sequence IF statements and provide the build process with some logic. Gathering these WMI tags can be tricky, so we put together a VB Script to pull out the 10 most popular items and display them to the screen - we also copy the results to a file called sysinfo.txt. By running this file on the machines that will be built, we can ensure that we use the correct WMI entries for things like MANUFACTURER, MODEL and CHASIS.&lt;/P&gt;
&lt;P&gt;The scipt (sysinfo.vbs)&amp;nbsp;is listed below&amp;nbsp;and is a variation on the script used by BDD to gather information at the start of the build process:&lt;/P&gt;
&lt;P&gt;' Initialization&lt;BR&gt;Set fso = CreateObject("Scripting.FileSystemObject")&lt;BR&gt;Set shell = CreateObject("Wscript.Shell")&lt;BR&gt;Set reg = GetObject("winmgmts:root\default:StdRegProv")&lt;BR&gt;Dim sOutput&lt;/P&gt;
&lt;P&gt;On Error Resume Next&lt;/P&gt;
&lt;P&gt;' Create the appropriate OS information&lt;BR&gt;For each os in GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"XP") &amp;lt;&amp;gt; 0 then Call makefile("OS = XP")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"2000") &amp;lt;&amp;gt; 0 then Call makefile("OS = WIN2000")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"2003") &amp;lt;&amp;gt; 0 then Call makefile("OS = WIN2003")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"NT") &amp;lt;&amp;gt; 0 then Call makefile("OS = NT4")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"2000 Server") &amp;lt;&amp;gt; 0 then&amp;nbsp; Call makefile("OSTYPE = SERVER")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"Advanced Server") &amp;lt;&amp;gt; 0 then&amp;nbsp; Call makefile("OSTYPE = ADVANCED")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"Professional") &amp;lt;&amp;gt; 0 then&amp;nbsp; Call makefile("OSTYPE = PRO")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"Standard") &amp;lt;&amp;gt; 0 then Call makefile("OSTYPE = STANDARD")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"Enterprise") &amp;lt;&amp;gt; 0 then Call makefile("OSTYPE = ENTERPRISE")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.caption,"Web") &amp;lt;&amp;gt; 0 then Call makefile("OSTYPE = WEB")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If os.ServicePackMajorVersion &amp;lt;&amp;gt; "" then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("OSSP = " &amp;amp; os.ServicePackMajorVersion)&lt;BR&gt;&amp;nbsp;&amp;nbsp; Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("OSSP = NONE")&lt;BR&gt;&amp;nbsp;&amp;nbsp; End if&lt;BR&gt;Next&lt;/P&gt;
&lt;P&gt;' Obtain the enclosure type&lt;BR&gt;for each Enclosure in GetObject("winmgmts:").InstancesOf("Win32_SystemEnclosure")&lt;BR&gt;&amp;nbsp;&amp;nbsp; if join (Enclosure.Tag)&amp;lt;&amp;gt;"System Enclosure 1" then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CaseType = Enclosure.ChassisTypes(0)&lt;BR&gt;&amp;nbsp;&amp;nbsp; end if&lt;BR&gt;next&lt;BR&gt;Select case CaseType&lt;BR&gt;&amp;nbsp; Case "3", "4", "5", "6", "7", "15"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("CHASSIS = " &amp;amp; "DESKTOP")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;Case "8", "10", "12", "14", "18", "21"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("CHASSIS = " &amp;amp; "LAPTOP")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Case "23"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("CHASSIS = " &amp;amp; "SERVER")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Case ELSE&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("CHASSIS = " &amp;amp; "OTHER")&lt;BR&gt;End Select&lt;/P&gt;
&lt;P&gt;' Since there is no good way to identify a Tablet PC except by using an API call (GetSystemMetrics),&lt;BR&gt;' cheat and use a well-known registry location.&lt;BR&gt;Err.Clear&lt;BR&gt;ver = shell.RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Tablet PC\Ident")&lt;BR&gt;If Err then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Not a tablet&lt;BR&gt;Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Call makefile("OSTYPE = TABLET")&lt;BR&gt;End if&lt;/P&gt;
&lt;P&gt;' Obtain the HAL that is being used&lt;BR&gt;halID = shell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E966-E325-11CE-BFC1-08002BE10318}\0000\MatchingDeviceId")&lt;BR&gt;halName = shell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E966-E325-11CE-BFC1-08002BE10318}\0000\DriverDesc")&lt;BR&gt;'Wscript.Echo "HAL ID=" &amp;amp; halID&lt;BR&gt;'Wscript.Echo "HAL Name=" &amp;amp; halName&lt;BR&gt;Call makefile("HALID = " &amp;amp; halID)&lt;BR&gt;Call makefile("HALNAME = " &amp;amp; halName)&lt;/P&gt;
&lt;P&gt;' Obtain the manufacturer and model&lt;BR&gt;For each os in GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,os.Manufacturer," ") &amp;lt;&amp;gt; 0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Manu=Left(os.Manufacturer,(instr(1,os.Manufacturer," "))-1)&lt;BR&gt;&amp;nbsp;&amp;nbsp; else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Manu=os.manufacturer&lt;BR&gt;&amp;nbsp;&amp;nbsp; end if&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("MANUFACTURER = "&amp;amp;manu)&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("MODEL = "&amp;amp;os.model)&lt;BR&gt;Next&lt;/P&gt;
&lt;P&gt;' Get the CD/DVD information&lt;BR&gt;x = 0&lt;BR&gt;CD = false&lt;BR&gt;DVD = false&lt;BR&gt;For each os in GetObject("winmgmts:").InstancesOf("Win32_CDROMDrive")&lt;BR&gt;&amp;nbsp;&amp;nbsp; x = x + 1&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,UCASE(os.name),"RW") &amp;lt;&amp;gt; 0 then Call makefile("CDROM-RW")&lt;BR&gt;&amp;nbsp;&amp;nbsp; If Instr(1,UCASE(os.name),"DVD") &amp;lt;&amp;gt; 0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DVD = true&lt;BR&gt;&amp;nbsp;&amp;nbsp; ElseIf instr(1,UCASE(os.name),"DV")&amp;lt;&amp;gt;0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DVD = true&lt;BR&gt;&amp;nbsp;&amp;nbsp; ElseIf instr(1,UCASE(os.name),"CD")&amp;lt;&amp;gt;0 then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CD = true&lt;BR&gt;&amp;nbsp;&amp;nbsp; End If&lt;BR&gt;Next&lt;BR&gt;If DVD then&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("CDROM = DVD")&lt;BR&gt;ElseIf CD then&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("CDROM = CD")&lt;BR&gt;Else&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("CDROM = NONE")&lt;BR&gt;End if&lt;/P&gt;
&lt;P&gt;' Get the BIOS information&lt;BR&gt;For each os in GetObject("winmgmts:").InstancesOf("Win32_BIOS")&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("BIOS = "&amp;amp;os.SMBIOSBIOSVERSION)&lt;BR&gt;Next&lt;/P&gt;
&lt;P&gt;' Get the video information&lt;BR&gt;For each os in GetObject("winmgmts:").InstancesOf("Win32_VideoController")&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("VIDEO = "&amp;amp;os.name)&lt;BR&gt;next&lt;/P&gt;
&lt;P&gt;' Get the audio information&lt;BR&gt;For each os in GetObject("winmgmts:").InstancesOf("Win32_SoundDevice")&lt;BR&gt;&amp;nbsp;&amp;nbsp; Call makefile("Audio = "&amp;amp;os.name)&lt;BR&gt;Next&lt;/P&gt;
&lt;P&gt;' Display output&lt;BR&gt;shell.popup sOutput&lt;/P&gt;
&lt;P&gt;'create a file called sysinfo.txt&lt;BR&gt;call CreateFile&lt;/P&gt;
&lt;P&gt;Sub Makefile (filename)&lt;BR&gt;&amp;nbsp;filename = Trim(filename)&amp;nbsp;' Strip whitespace&lt;BR&gt;&amp;nbsp;sOutput = sOutput &amp;amp; filename &amp;amp; vbcrlf&lt;BR&gt;End sub&lt;/P&gt;
&lt;P&gt;Sub CreateFile()&lt;BR&gt;&amp;nbsp;Set objFSO = CreateObject("Scripting.FileSystemObject") &lt;BR&gt;&amp;nbsp;Set objTextFile = objFSO.OpenTextFile("sysinfo.txt", 2, True) &lt;BR&gt;&amp;nbsp;objTextFile.WriteLine sOutput &lt;BR&gt;&amp;nbsp;objTextFile.Close &lt;BR&gt;End Sub&lt;BR&gt;&lt;/P&gt;
&lt;P&gt;A simple&amp;nbsp;alternative to this script - if you just want to find make and model information - is to follow the process identified by my&amp;nbsp;MCS&amp;nbsp;colleague &lt;A class="" title=Ben href="http://blogs.technet.com/benhunter" target=_blank mce_href="http://blogs.technet.com/benhunter"&gt;Ben&lt;/A&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 6pt 0cm 3pt 47.35pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1"&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ; mso-fareast-font-family: Arial"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ"&gt;Open a &lt;B&gt;Command Prompt&lt;/B&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 6pt 0cm 3pt 47.35pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1"&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ; mso-fareast-font-family: Arial"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ"&gt;Type &lt;B&gt;WMIC&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 6pt 0cm 3pt 47.35pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1"&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ; mso-fareast-font-family: Arial"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ"&gt;To determine the Make, type &lt;B&gt;CSProduct Get Vendor&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraph style="MARGIN: 6pt 0cm 3pt 47.35pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1"&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ; mso-fareast-font-family: Arial"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN-NZ style="mso-ansi-language: EN-NZ"&gt;To determine the Model, type &lt;B&gt;CSProduct Get Name&lt;/B&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Ben also has an excellent article on how to use specific WMI&amp;nbsp;information in rules to perform different tasks based on hardware types.&amp;nbsp;You can find his blog entry&amp;nbsp;&lt;A class="" title=here href="http://blogs.technet.com/benhunter/archive/2007/05/20/bdd-2007-tips-and-tricks-identifying-hardware-types.aspx" target=_blank mce_href="http://blogs.technet.com/benhunter/archive/2007/05/20/bdd-2007-tips-and-tricks-identifying-hardware-types.aspx"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=1672072" width="1" height="1"&gt;</description><category domain="http://blogs.technet.com/richardsmith/archive/tags/BDD2007/default.aspx">BDD2007</category><category domain="http://blogs.technet.com/richardsmith/archive/tags/BDD2.5/default.aspx">BDD2.5</category><category domain="http://blogs.technet.com/richardsmith/archive/tags/Build+Process/default.aspx">Build Process</category><category domain="http://blogs.technet.com/richardsmith/archive/tags/Scripting/default.aspx">Scripting</category></item></channel></rss>