Running PowerShell in Windows 8 (or 8.1) PE Environment
Running PowerShell in Windows 8 (or 8.1) PE Environment
Microsoft promotes the use of PowerShell in Windows 8/8.1. Courseware materials even suggest that MCT’s instruct their students regarding specific PowerShell capability for use in preparing drives, deploying Windows Image Files, and performing trouble shooting operations from the Windows Recovery Environment.
Yet PowerShell is not natively in the Windows PE image or Windows 8/8.1 RE environment.
This blog will provide some basic direction for adding PowerShell to your PE environment so that you can use this powerful command line and scripting tool. Microsoft provides a TechNet article with explicit instructions for the addition of PowerShell to a PE environment, suggesting specifically that it be added during the creation of PE media.
In order to affect this process, you must first download and install the Windows Assessment and Deployment Kit (ADK) for Windows 8/8.1. If you select the minimum components, you will have everything that you need to create the PE media, though you may want to select additional components of the ADK if you are supporting enterprise deployment processes.
Take careful note of the install directory of the Windows 8/8.1 ADK. You will likely need to modify the script provided in the TechNet article, and it is easier if you take note of the install directory BEFORE you attempt to use the script and discover that you need to clean up files and conduct a second pass.
Microsoft TechNet provides a set of instructions for modifying a Windows PE image using DISM to Add PowerShell Support to Windows PE. This works if you are creating a WinPE image, though you need to understand the creation of PE bootable media since several steps are missing. Most notably, the boot.wim file associated with Windows installation and pre-execution environments contains two images: the PE environment and the Windows setup environment. When modifying a boot.wim or PE environment image, it is important to add any drivers, components, or packages to both of the embedded images.
Create the CopyPE directory structure as suggested in the TechNet article by launching the Deployment and Imaging Tools Environment in Administrative Mode.
Run the COPYPE <a> <dest> command, substituting x86, amd64 or arm for <a> and creating a destination directory for <dest>.
I used the recommendation from the TechNet article, since I will be testing on a 64 bit system.
Copype amd64 c:\WinPE_amd64_PS
Note: It does not matter what you name the destination directory, but you do NOT want to create it in advance.
I then copied the Sample Script from the TechNet article and pasted it into a Notepad file. If you take note of the install location for ADK on my system (look at the path in the snapshot above), you will note that installation recommended “Program Files (x86)” rather than merely “Program Files”. As a result, I needed to edit the script file by substituting:
“C:\Program Files (x86)\Windows Kits\8.1” for each instance of “C:Program Files\Windows Kits\8.1”.
I saved the script as a file called CreatePE-PS.cmd.
I then simply ran the .cmd file from the Deployment and Imaging Tools environment that I had already opened in administrative mode.
Now insert a USB drive into your system and take note of the drive letter assigned. (Double check in Windows Explorer). You do not need to format the USB drive. It will be formatted during the process, so make sure you do not select a USB drive containing content that you wish to retain.
I inserted a 2 GB USB 2.0 stick into my system and it was assigned drive letter D.
I ran the command MakeWinPEMedia /UFD C:\WinPE_amd64_PS D:
With the Windows 8.1 ADK, you can create a bootable USB stick without using the utility that I referenced in a previous blog Simplify your Windows 8 Evaluation Install.
Having previously modified my BIOS (UEFI) to bypass fastboot and select my USB port as the primary boot location, I inserted the USB stick and booted into the Windows PE environment.
At the X:\windows\system32> prompt, I typed PowerShell.
Voila…PowerShell tools within the Windows PE environment.
Although I did not experience the issue, some references to the use of PowerShell suggest that you must navigate to the PowerShell directory under the Windows PE root in order to use PowerShell commands.
One related reference by Heath762 Powershell and Windows PE indicates that you may merely need to alter the Environment variables for your PE environment so PowerShell cmdlets are recognized without explicit paths.
You May Also Like
Mark Jacob, Cisco Instructor, presents an introduction to Cisco Modeling Labs 2.0 or CML2.0, an upgrade to Cisco’s VIRL Personal Edition. Mark demonstrates Terminal Emulator access to console, as well as console access from within the CML2.0 product. Hello, I’m Mark Jacob, a Cisco Instructor and Network Instructor at Interface Technical Training. I’ve been using … Continue reading A Simple Introduction to Cisco CML2
This content is from our CompTIA Network + Video Certification Training Course. Start training today! In this video, CompTIA Network + instructor Rick Trader demonstrates how to use cable testers in network environments. Let’s look at some tools that we can use to test our different cables in our environment. Cable Testers Properly Wired Connectivity … Continue reading Cable Testers and How to Use them in Network Environments
In this video, Security Instructor Mike Danseglio demonstrates how to use BitLocker in Window 10 to secure files on a USB Flash drive that adhere to stricter data protection requirements as found inside Government entities. BitLocker 2-day instructor-led training is now available at Interface: BITLOCK: Planning and Deploying BitLocker Drive Encryption Training Video Transcription: Hi. … Continue reading Government Edition – Encrypting a USB Flash Drive in Windows 10