Thursday, July 11, 2013

Powershell script to enable command-shell in winPE 3.1 boot images for use in ConfigMgr 2012 R2

Following Brandon Linton's post about creating and importing a WinPE 3.1 boot image for use in ConfigMgr 2012 SP1 CU2, below is a little Powershell script to enable command-shell

#CM2012 R2 - Enable Command-Shell in WinPE 3.1 Boot Image

#Replace below OSDxxxxx with your boot image package ID
$BootImagePackageID = "OSDxxxxx" 

#Get the Boot image - Replace OSD by your site code
$BootImageQuery = Get-WmiObject -Namespace "Root\SMS\Site_OSD" -Class SMS_BootImagePackage -Filter "PackageID='$BootImagePackageID'"

#Read Properties

#Enable Command-Shell
$BootImageQuery.EnableLabShell = 'True'

#Update Distribution Points


  1. very helpful, many thanks (need pe3.1 boot images for vmware 4.x...)

  2. I am having some difficulties executing this, can you confirm the process in which to carry this out. Many thanks in advance.

  3. @Lee Martin - Did you follow Brandon Linton's blog post to first import a winpe 3.1 image ?
    If yes, at which point do you have difficulties ?

  4. Thanks for coming back to me. Yes I have a Win pe 3.1 boot image from my 07 env I have imported in and would like to use this to add in the command support. Question was more aroudn where to execute script. Site Server or technician machine with boot image on? I tried to run it in its current form with my package ID but got some errors. I am trying this on R2, i know its not for that directly but was hoping it may work.
    Thanks in advance.