WMIC Commands to Find Basic Computer Information

wmic csproduct get vendor,name,identifyingnumber
wmic bios get serialnumber

 

wbemtest.exe

References:

http://technet.microsoft.com/en-us/library/bb742610.aspx

http://people.virginia.edu/~rtg2t/winadmin/wmic.html

http://ss64.com/nt/wmic.html

 

Advertisements

Windows Developer Preview – Create a WinPE 4.0 Boot ISO

You must be a Microsoft Partner or have an MSDN subscription in order to download ADK (formerly called WAIK).

Info here: http://msdn.microsoft.com/en-us/library/windows/hardware/br259106.aspx

Extract/install ADK (en_windows_developer_preview_adk_x86_x64_734756.zip) on a machine…

(The setup file is called “adksetup.exe” at the time of this writing after extracting the ZIP as you do not need to run each MSI individually 🙂 .)

Navigate to:

C:\Program Files\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\Media

Copy this folder to your ISO builder machine with ADK installed:

C:\Temp\WinPE\Media

Now, copy C:\Program Files\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\en-us\winpe.wim into:

C:\Temp\WinPE\Media\Sources (make this new folder)

Rename the “winpe.wim” to “boot.wim
Copy both “etfsboot.com” and “oscdmg.exe” from:

C:\Program Files\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\x86\Oscdimg

to:

C:\Temp\WinPE\

Now, with all the base tools in place, it is time to create the ISO:

Open Deployment Tools Command Prompt (Elevated).

Change your directory to:

C:\Temp\WinPE

Run the following command:

oscdimg.exe -b"etfsboot.com" -n Media ISOFILENAME.iso

OK, that’s a brand new WinPE 4.0 “vanilla” disk for you.

 

 

What about some additional drivers or applications?

We are going to have to edit that default WinPE.wim (renamed above to boot.wim) with new stuff!

How-to add some optional components…

They all live in the following directory:

C:\Program Files\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs

Copy them to:

C:\Temp\WinPE\WinPE_OCs

Create a mount point for the base WIM.
This is a fancy sentence for make a new folder from the deployment tools command line:

md C:\MOUNT

From C:\Temp\WinPE, run:

imagex.exe /mountrw Media\Sources\boot.wim 1 c:\MOUNT

Add your new optional components:

dism /image:c:\MOUNT /add-package /PackagePath:"C:\Temp\WinPE\WinPE_OCs\WinPE-Scripting.cab"

Add the associated language portion of the package (otherwise the package you just added won’t work):

dism /image:c:\mount /add-package /PackagePath:"C:\Temp\WinPE\WinPE_OCs\en-us\WinPE-Scripting_en-us.cab"

NOTE: If you want Powershell support in your WinPE 4.0 environment (WinPE-PowerShell3.cab, WinPE-PowerShell3_en-us.cab), it also requires .NET4 (WinPE-NetFx4.cab, WinPE-NetFx4_en-us.cab) to process. Make sure to add all four listed here.

Let’s add some drivers:

dism /image:c:\MOUNT /add-driver /driver:"C:\Path\To\Driver\NIC.inf"

If you are lazy and have stand-alone executables that can run, you can also just drop them right into the mounted ISO directory:

Make a new folder to hold them:
C:\MOUNT\Tools

Copy tools you can run via command line here (Sysinternals’ Process Explorer, etc.)
Example:
C:\MOUNT\Tools\x86\imagex.exe
C:\MOUNT\Tools\x64\random-app.exe

Commit the changes (or lose all your hard work!):

imagex.exe /unmount /commit C:\MOUNT

Note: Make sure to close any Explorer.exe processes that have your working directories open, or the unmount process “sticks” and doesn’t unmount correctly.

Regenerate your ISO with the same command from above:

oscdimg.exe -b"etfsboot.com" -n Media ISOFILENAMEv2.iso

Extras…

Edit the WinPE Registry for your own customization:

Mount the hive from the deployment tools command prompt:

reg load HKLM\Temp c:\mount\Windows\System32\config\DEFAULT

Open REGEDIT on your builder workstation. Edit to your will manually or import a previously written .REG file

Example (if you opened MyCustomSettings.reg in Notepad I have saved on my desktop, it would read):

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Temp\Console\%SystemRoot%_system32_cmd.exe]
"ScreenColors"=dword:0000000a
"FontSize"=dword:0010000c
"FontFamily"=dword:00000030
"FontWeight"=dword:00000190
"FaceName"="Terminal"
[HKEY_LOCAL_MACHINE\Temp\Software\Sysinternals\Process Explorer]
"EulaAccepted"=dword:0000001

Now you have green display text instead of the standard white and the EULA has been accepted for Sysinternals Process Explorer.
IMPORTANT: UNLOAD THE REGISTRY HIVE WHEN COMPLETED! (File > Unload Hive) if you don’t want to have that hive loaded permanently on your builder machine. Regenerate your ISO file using oscdimg.exe above.

Reference: http://truesec.com/news/newsletter_september_2011

Edit: Updated file paths. Assuming you are building an x86 WinPE environment on x86 OS.