WinPE auto scripts

user1438615 picture user1438615 · Jun 6, 2012 · Viewed 22.3k times · Source

I have just set up a bootable UFD with WinPE 3.0, and I need it to run a couple of scripts automatically on boot.

I was wondering if anyone had any advice on setting up automatic scripts for listing the partitions on the local drive, showing the date of the system, listing the current IP, and capturing an image of the local drive.

If anyone can help that would be great! Thanks.

Answer

Zero picture Zero · Jul 16, 2012

Build your scripts independently and test their functionality prior to placing them inside of your WinPE. Then mount your winPE so you can edit it and place all of your scripts in the winPE

Mounting command:

DISM /Mount-WIM /WimFile:C:..[dir of where your wine is located]\ISO\sources\boot.wim /index:1 /MountDir:mount

Then place your scripts inside of a folder inside your mount folder (which now should have stuff inside of it). Once that completed, you can easily call them by modifying the ..\Windows\System32\startnet.cmd file.

NOTE: DO NOT REMOVE the first line wpeinit. Just add after it: start <scriptname.bat or .vbs>

Save and close.

Keep in mind: if you are doing scripts inside of winPE that handles anything with the NIC, you will need to insert the network drivers into your WinPE. Once your winpe loads, it automatically calls startnet.cmd first.

Some tutorials to do so can be located here.