In the event that you need to import a WinPE 4.0 or 3.1 boot image into ConfigMgr 2012 R2, you may want to enable the F8 command line support once you have imported the boot image. Since the servicing capabilities for such boot images are disabled, we need to go outside the ConfigMgr console to make this kind of change.

Information

This is what it looks like when you have imported a legacy boot image (WinPE 4.0 or WinPE 3.1) into ConfigMgr 2012 R2:

101_1_1

In my lab environment I’ve imported a clean WinPE 4.0 wim file and named it WinPE 4.0 (x86) as you can see in the picture above. In order to enable the F8 command line support for this boot image, we could either use wbemtest or PowerShell. I’m not a fan of the wbemtest utility for various reasons, and I prefer using PowerShell when possible. Before we go ahead and execute the PowerShell script, we need to know what we’re going to do. In the SMS Provider, there’s a class called SMS_BootImagePackages. For each boot image in your environment, there’s an instance with a set of properties. The property that we’re interested in is called EnableLabShell. If you examine this property, you’ll notice that it’s a lazy property (see this great article by Trevor Sullivan, PowerShell MVP). In the picture below, I’m using WMI Explorer to examine the instance of my boot image:

101_2

As shown in the picture, my boot image has a PackageID of CAS00020. This can be found in the ConfigMgr console by navigating to Software Library, Operating Systems and Boot Images. See picture below:

101_3

Since the EnableLabShell property has a value of False, we need to change it to True by using PowerShell. In the script that we’ll be using, we need to reference the instance of the boot image object directly. If we don’t do that, things will go bad.

Download the script

I’ve made the script available on the TechNet Gallery, and it’s available for download here.

Using the script

The script has two ways it can be executed in. The first one is where it will only query for the Boot Images. To actually make any changes to the instances, you’ll need to specify the -Commit switch.

Querying for Boot Images

1. Download the script to C:\Scripts.
2. Open an elevated PowerShell console and run the following command:

.\Set-CMBootImageEnableCommandLineSupport.ps1 -SiteServer CAS01 -SiteCode CAS -BootImageName "Win"

Note! Remember to change the SiteServer, SiteCode and BootImageName parameters for your own environment.

101_4

Committing changes to Boot Images

1. Download the script to C:\Scripts.
2. Open an elevated PowerShell console and run the following command:

.\Set-CMBootImageEnableCommandLineSupport.ps1 -SiteServer CAS01 -SiteCode CAS -BootImageName "Win" -Commit

101_5

Note! Remember to change the SiteServer, SiteCode and BootImageName parameters for your own environment.

When you have executed the script and committed, remember to run the Update Distribution Points for the specified Boot Image(s).

You should now be able to press F8 in your legacy WinPE boot images!

Nickolaj Andersen
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(577)

comments
  • Steve
    Posted at 19:06 July 2, 2014
    Steve
    Reply
    Author

    Is this only for R2 or will it also work in 2012 SP1?

    • Nickolaj
      Posted at 19:37 July 2, 2014
      Nickolaj
      Reply
      Author

      Hi Steve,

      WinPE 4.0 images are the ones that you get with Windows ADK 8.0 and that’s a prerequisite for ConfigMgr SP1, so this should not be needed since you should be able to service such boot images. Are we talking about WinPE 3.1?

      Regards,
      Nickolaj

  • Steve
    Posted at 16:06 July 3, 2014
    Steve
    Reply
    Author

    Yes, I have a PE 3.1 image imported in to SP1 w/CU2. I tried your script but the WMI field appears to be locked. Changing false to true doesn’t stick.

  • Steve
    Posted at 19:19 July 18, 2014
    Steve
    Reply
    Author

    Thanks for finding the other method of using wbemtest. That worked for me.

  • kevin
    Posted at 23:30 November 26, 2015
    kevin
    Reply
    Author

    hi nickolaj, just letting you know I was getting an error when trying to commit
    exception calling “put” with “0” argument(s): “generic failure “.
    But I was running it on a different primary server, went over to my cas and it ran fine.

  • Bongo
    Posted at 15:04 December 29, 2015
    Bongo
    Reply
    Author

    I guess this is run on the server.

    if line 13 held the variable for machine name you could execute from a remote system.

    $BootImages = Get-WmiObject -ComputerName $SiteServer -Namespace “root\SMS\site_$($SiteCode)” -Class SMS_BootImagePackage -Filter “Name like ‘%$($BootImageName)%'”

  • Damo
    Posted at 23:27 April 25, 2016
    Damo
    Reply
    Author

    I get the following error, when running the script from the scripts folder as a Domain Admin

    “Get-WmiObject : Invalid namespace “root\SMS\site_MB1”
    At D:\Scripts\Set-CMBootImageEnableCommandLineSupport.ps1:13 char:19
    + $BootImages = Get-WmiObject -Namespace “root\SMS\site_$($SiteCode)” -Class S …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-WmiObject], ManagementException
    + FullyQualifiedErrorId : GetWMIManagementException,Microsoft.PowerShell.Commands.GetWmiObjectCommand”

    • Nickolaj
      Posted at 13:45 April 27, 2016
      Nickolaj
      Reply
      Author

      Hi Damo,

      Are you running the script on your Primary Site server? Have you installed the SMS Provider remotely to your Primary Site server?

      Regards,
      Nickolaj

  • Srinivas
    Posted at 01:41 June 27, 2017
    Srinivas
    Reply
    Author

    I have applied the changes and and set EnableLabShell= true. Verified it in WMI Explorer and the value is set to True. Redistributed the boot image and created task sequence media, but still F8 is not enabled. The boot image version that I am currently using is 10.0.10240.

  • Leave a Reply