• Home
  • About 404TS
  • Contact

404 Tech Support

Where IT Help is Found

  • Articles
    • Code
    • Entertainment
    • Going Green
    • Hardware, Gadgets, and Products
    • Management
    • Network
    • News
    • Operating Systems
    • Security and Privacy
    • Software
    • System Administration
    • Talking Points
    • Tech Solutions
    • Web
    • Webmaster
  • Reviews
  • Media
    • Infographics
    • Videos
  • Tech Events
  • Tools
    • How do I find my IP address?
    • Browser and plugin tests
  • Get a Technical Consultation
You are here: Home / Articles / Code / Creating a WinPE LiveCD for WMI lookups

Creating a WinPE LiveCD for WMI lookups

2012-03-26 by Jason

I’m currently reconfiguring my organization’s deployment server to use the DriverGroup001 variable instead of just using PnP matching for driver injection. We have had too many models interfering with each other. Bad drivers or just bad driver matches will lead to a BSoD or a buggy computer that requires more time troubleshooting or reimaging. The DriverGroup variable I’m setting points the Drivers to a folder for the operating system, a subfolder per manufacturer, and then a subfolder per model.

The manufacturer and model have to be exactly the same as what the deployment will see when it queries the %make% and %model% variables from the BIOS. I have previously shown how to get that information from a working computer using scripts and WMI but how do you get that information when you don’t have a running PC to run those scripts?

I created a WinPE LiveCD that I can boot from with the WMI query so I can get my deployment up and running quickly.

The first task is to install the Windows 7 OEM Preinstall Kit or Windows Automated Install Kit (AIK) for Windows 7. Both work but some paths in the commands will change for your version. I built my boot CD with Windows AIK.

Once your tool is installed, find it on the Start Menu and run the Windows AIK Deployment Command Line Tools as an administrator (elevated command prompt). Once the command prompt opens, run this command to copy the needed files to your working directory (can be anywhere):

copype.cmd x86 c:\winpe

The x86 indicates that I’m building the 32-bit architecture of the tool. I chose that for simplicity and compatibility. Your other options include amd64 and ia64.

With Windows 7, WinPE is at version 3.0. Version 2.0 used ‘peimg’ as a command line tool. With version 3, we use DISM or Deployment Image Servicing and Management. We mount the Windows image that was just copied over using this command:

dism /mount-wim /WimFile:C:\winpe\winpe.wim /index:1 /MountDir:C:\winpe\mount

The vanilla WinPE is pretty simplistic. We will need to install some additional packages to get WMI working. For each package, you have to install the language-neutral and then the language specific package. You can find the packages here: C:Program FilesWindows AIKToolsPEToolsx86WinPE_FPs

To add the WMI package, we run these commands:

DISM /Image:c:winpemount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPEToolsx86WinPE_FPswinpe-wmi.cab"
DISM /Image:c:winpemount /Add-Package /PackagePath:"C:Program FilesWindows AIKToolsPEToolsx86WinPE_FPsen-uswinpe-wmi_en-us.cab"

Unfortunately just the WMI package is not enough to get it working. You will get an error like “class not registered” or “invalid class string” if you don’t have all the needed packages. I also added the scripting, MDAC, and HTA packages (both language neutral and language specific).

I wrote a little script to make it easier on myself and coworkers that might use this tool to script the WMI query with the WMIC command line tool.

WMIC computersystem get manufacturer
WMIC computersystem get model
pause

I saved the file as make_model.cmd and copied it to my mounted location under Windowssystem32 since that is where the WinPE command prompt starts up. To make it even easier, I copied those lines into the mounted WindowsSystem32Startnet.cmd file so the commands run first thing after the wininit command automatically.

Next, we’ll need to unmount and save the changes to the image running this command:

Dism /unmount-wim /mountdir:c:winpemount /commit

We copy the .wim file at the top of our file into our ISO folder.

copy c:\winpe\winpe.wim c:winpe\ISO\sources\boot.wim

Next, we turn that folder into a bootable .iso file using an included tool and .com file with this line:

Oscdimg -n -bC:\winpe\Etfs\boot.com C:\winpe\ISO C:\winpe\winpe.iso

Finally, we can burn that .iso file or test it in a VM to make sure it’s working. Now finding out the information I need is as easy as booting to a CD and jotting down the results from the script.

You can download the iso file that I created and extract with 7-zip.

A lot of this information was obtained from Microsoft TechNet articles but it wasn’t updated to WinPE 3.0 (it was using peimg instead of dism). Here is an updated article that helps with the general process of building a WinPE LiveCD.

Filed Under: Code, System Administration

Trending

  • ARRIS introduces their first DOCSIS 3.1 cable modem with the SURFboard SB8200, available on Amazon
    In Featured, Hardware, Gadgets, and Products, Network
  • The growth of Magento for e-commerce
    In Infographics
  • Where to find the results from a scheduled Chkdsk
    In Tech Solutions

Latest Media Posts

Find Out Where To Download SNES ROMs

Find Out Where To Download SNES ROMs

Multifunctional Video Conversion Tools – Wondershare Video Converter

Multifunctional Video Conversion Tools – Wondershare Video Converter

  • Popular
  • Latest
  • Today Week Month All
  • How to ‘Unblock’ multiple files at a time with PowerShell How to 'Unblock' multiple files at a time with PowerShell
  • Increase IIS Private Memory Limit to improve WSUS availability Increase IIS Private Memory Limit to improve WSUS availability
  • Command line to take ownership and change permissions Command line to take ownership and change permissions
  • Creating and editing views in phpMyAdmin Creating and editing views in phpMyAdmin
  • Read the Event Logs on Windows Server Core Read the Event Logs on Windows Server Core
  • How to Purchase Cryptocurrencies? How to Purchase Cryptocurrencies?
  • Top 6 necessary aspects to consider when hiring Angular developers Top 6 necessary aspects to consider when hiring Angular developers
  • Full guide on drawbacks and benefits of Node.js for making the perfect choice for your business Full guide on drawbacks and benefits of Node.js for making the perfect choice for your business
  • Benefits of End-To-End Testing That Will Match Company Expectations Benefits of End-To-End Testing That Will Match Company Expectations
  • 3 Key Features of Pets Health Monitoring Systems 3 Key Features of Pets Health Monitoring Systems
Ajax spinner

Elevator Pitch

404 Tech Support documents solutions to IT problems, shares worthwhile software and websites, and reviews hardware, consumer electronics, and technology-related books.

Subscribe to 404TS articles by email.

Recent Posts

  • How to Purchase Cryptocurrencies?
  • Top 6 necessary aspects to consider when hiring Angular developers
  • Full guide on drawbacks and benefits of Node.js for making the perfect choice for your business

Search

FTC Disclaimer

404TechSupport is an Amazon.com affiliate; when you click on an Amazon link from 404TS, the site gets a cut of the proceeds from whatever you buy. This site also uses Skimlinks for smart monetization of other affiliate links.
Use of this site requires displaying and viewing ads as they are presented.

Copyright © 2023 · Magazine Pro Theme on Genesis Framework · WordPress · Log in