RegenerateBootImageWinPE10 Powershell Script

A PowerShell script to automate and simplify the process of regenerating the Windows 10-based boot images with the latest winpe.wim.

 
 
 
 
 
4.5 Star
(6)
12,538 times
Add to favorites
System Center
9/9/2016
E-mail Twitter del.icio.us Digg Facebook
  • Error
    4 Posts | Last post April 15, 2019
    • I am getting the following error.  Please advise on how to correct.
      
      1/26/2017 2:20:48 PM Found SCCM-Console-Environment
      1/26/2017 2:20:48 PM D:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1
      1/26/2017 2:20:48 PM SiteCode: S01
      1/26/2017 2:20:48 PM SiteServer: SCCM.preti.local
      1/26/2017 2:20:48 PM Prepare Environment for Boot Image operations. Create PS-Drive if not found.
      1/26/2017 2:20:48 PM Trying to generate Boot images
      1/26/2017 2:20:48 PM Connecting to WMI Namespace: \\SCCM.preti.local\root\sms\site_S01:SMS_BootImagePackage
      1/26/2017 2:20:48 PM \\SCCM.preti.local\SMS_S01\OSD\boot\x64\CMx64Boot.wim not found no need to backup
      1/26/2017 2:20:48 PM Generating x64 Boot Image. This will take a few minutes...
      1/26/2017 2:20:48 PM Error: Failed to create x64 Boot Image. Exit x64 Boot Image post taks
    • Hi there,
      
      I know that this is an old question but maybe it will help others. I was getting this exact same error when using the script but it is actually caused by a failed ADK installation OR Secure Boot being enabled after ADK installation.
      
      Steps to resolve;
      -Uninstall all ADK packages
      -Shutdown server
      -Turn off Secure Boot
      -Start and install latest ADK
      -Restart
      -Run this awesome script
      
      Some info on ADK and secure boot: https://social.msdn.microsoft.com/Forums/en-US/1fa43cc7-a82d-4dd3-8d28-f76fe2d7593e/hardware-development-kits-for-windows-10-version-1703-april-2017?forum=wdk
      
      Hope this helps.
      
      
    • Is there any other solution to this?
      Error: Failed to create x64 Boot Image. Exit x64 Boot Image post tasks
      
      I tried the steps from v-juanmm but this has no effect on the script.
      Is there any way to find a more detailed error description?
      
      As far as I see the script creates the backup files and then failed. I have no idea what went wrong.
      
    • Same. Unable to determine what the cause is.
  • No longer works if you have multiple Providers
    1 Posts | Last post October 23, 2018
    • This script does not support multiple providers in your environment.
      It uses a WMI query to return the SCCM Provider and site Code adds it to variables: $SccmServer and $SiteCode
      If you have more than one - it returns them on one line to both parameters so the next steps fail.
      You can manually edit the script to force it to use a single provider.
      Line 146/147
          $SccmServer = $SMS.Machine
          $SiteCode = $SMS.SiteCode
      Set this to be the FQDN of your SCCM Provider, and your Site Code, both with single quotes.
  • PXEEnabled - Query
    1 Posts | Last post August 08, 2017
    • We are using PXE boot in the environment, do I need to select True in the powershell input?
  • PowerShell Set-Location error
    1 Posts | Last post June 28, 2017
    • I am trying to generate new Boot Images using this script but I keep getting an error  
      
      6/28/2017 9:04:56 AM Found SCCM-Console-Environment
      6/28/2017 9:04:56 AM E:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1
      6/28/2017 9:04:56 AM SiteCode: 001
      6/28/2017 9:04:56 AM SiteServer: SCCM.XXX.org
      6/28/2017 9:04:56 AM Prepare Environment for Boot Image operations. Create PS-Drive if not found.
      6/28/2017 9:04:56 AM CMSite-Provider does not have a Drive! Try to create it.
      6/28/2017 9:04:56 AM Exception Type: System.Management.Automation.ParameterBindingValidationException
      6/28/2017 9:04:56 AM Exception Message: Cannot bind argument to parameter 'Root' because it is null.
      6/28/2017 9:04:56 AM Trying to generate Boot images
      6/28/2017 9:04:56 AM Connecting to WMI Namespace: \\SCCM.XXX.org\root\sms\site_001:SMS_BootImagePackage
      6/28/2017 9:04:56 AM \\SCCM.XXX.org\SMS_001\OSD\boot\x64\CMx641703Boot.wim not found no need to backup
      6/28/2017 9:04:56 AM Generating x64 Boot Image. This will take a few minutes...
      6/28/2017 9:06:53 AM New x64 Boot Image created continue with post tasks
      6/28/2017 9:06:53 AM Performing actions section Boot Image not exist
      6/28/2017 9:06:53 AM Switching Drive for ConfigMgr-CmdLets
      Set-Location : Cannot find drive. A drive with the name '001' does not exist.
      At C:\Users\user.name\Desktop\RegenerateBootImageWinPE10-v7.ps1:236 char:17
      +                 Set-Location $SiteCode":"
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (001:String) [Set-Location], DriveNotFoundException
          + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
      6/28/2017 9:06:53 AM Import Boot Image into SCCM
      6/28/2017 9:06:53 AM Error: Failed to import \\SCCM.XXX.org\SMS_001\OSD\boot\x64\CMx641703Boot.wim
      
      
  • Instructions?
    2 Posts | Last post June 17, 2017
    • I'm stumped as to how to use this script. I've manually mounted and unmounted wim's in the past, which is a pain, which is why I was trying to use this script but despite it being linked to from everywhere I don't see any instructions provided.
    • Ah I thought the prompts I was entering were wrong and so I was trying to figure out what kind of values they needed because I was getting - Error: Failed to create x64 Boot Image. Exit x64 Boot Image post taks
      
      Turns out I just need to reboot the server.
      
      Even after the fact it generated new wim's just fine, they however did not contain any of my drivers, did not update on the DP's or get added to the "boot images" category in SCCM. They also did not carry across the settings that I specified as far as diagnostic prompt... But still they look like the right versions now. If they work it's still a less painful process than the manual way.
      
      Thanks.
  • Seems to work but no drivers in new image?
    2 Posts | Last post May 06, 2017
    • The whole point of using this script and not just load the new ADK's wim into SCCM manually(which would probably take less time) was that i have a million drivers loaded into my WIM. i used it, and no drivers exists in the new one...
      What's the point of this script then?
    • After I ran it for my boot .wims, I updated my DPs and the update wizard included all the drivers/components that were in the old .wims automatically.
  • has this been tested on CM1702?
    2 Posts | Last post April 11, 2017
    • just tested this in my lab running CM1702, ADK 1703 and mdt8443.
      script runs but the generated bootimage does not have all tabs like it should and the bootimage is not distributed even when asked to
    • nevermind, my mistake (missing reboot after installing latest ADK)
      the script works fine in this combination!
  • What need to be done next?
    1 Posts | Last post January 06, 2017
    • Ok the script ran ok, it copied an original boot.wim to \\sccmserver\sms_xxx\OSD\boot\x64 and added imageID at the end so the file is now named boot.xxx1000AA.wim and it also created boot.xxx1000AA.xxx1000AA.wim.
      I don't knoe which one is which.
      Do I have to do go the Software Library -> Boot Images and select the xxx1000AA image and change the data source? to match the new location? but which one? now I have two of them!
      
  • Verified on server 2016
    1 Posts | Last post December 06, 2016
    • Not a question, but it was request that we post if we found this worked on other operating systems.  Worked as expected on server 2016.
      
      Thanks!
      -LvilleSystemsJockey
  • Script execution
    4 Posts | Last post October 12, 2016
    • Dear Team
      
      RegenerateBootImageWinPE10-v7.ps1  parameters help 
      (Type !? for Help.) Does not work |? 
      Typing !? ask for each input instead to offer help
      
      BootImageName: CMBoot.wim
      BootImageConsoleName: Boot Image x64 1607
      BootImageConsoleDescription: WinPE ADK 1067
      BootImageConsoleVersion: 10.1.14393.0
      OSArchitecture: x64
      EnableDebugShell: False
      PxeEnabled: False
      OverwriteExistingImage: False
      UpdateDistributionPoints: True
      
      Help is provided if you open and read the provided paremeters inside the PS script
      
      
    • Sample of x86 image
      
      BootImageName: CMx86Boot.wim
      BootImageConsoleName: Boot Image x86 1607
      BootImageConsoleDescription: WinPE x86 ADK 1067
      BootImageConsoleVersion: 10.1.14393.0
      OSArchitecture: x86
      EnableDebugShell: False
      PxeEnabled: False
      OverwriteExistingImage: False
    • Open and admin PowerShell console set PS execution policy to Bypass, execute script and parameters in one line
      
      .\RegenerateBootImageWinPE10-v7.ps1 -BootimageName "CMx64Boot.wim" -BootImageConsoleName "Boot Image x86 1607" -BootImageConsoleDescription "WinPE x86 ADK 1067" -BootImageConsoleVersion "10.1.14393.0" -OSArchitecture "x64" -EnableDebugShell "False" -PxeEnabled "False"-OverwriteExistingImage "False" -UpdateDistributionPoints "False"
      
      You will got
      
      Found SCCM-Console-Environment
      E:\Program Files\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1
      SiteCode: C01
      SiteServer: CAS.root.com
      Prepare Environment for Boot Image operations. Create PS-Drive if not found.
      Trying to generate Boot images
      Connecting to WMI Namespace: \\CAS.root.com\root\sms\site_C01:SMS_BootImagePackage
      \\CAS.root.com\SMS_C01\OSD\boot\x64\CMx64Boot.wim not found no need to backup
      Generating x64 Boot Image. This will take a few minutes...
      New x64 Boot Image created continue with post tasks
      Performing actions section Boot Image not exist
      Switching Drive for ConfigMgr-CmdLets
      Import Boot Image into SCCM
      Successfully imported \\CAS.root.com\SMS_C01\OSD\boot\x64\CMx64Boot.wim
      Apply Boot Image Properties EnableCommandSupport with Value False and DeployFromPxeDistributionPoint with Value False
      Successfully applied Boot image properties
      
      NOTE> Server name are from my lab, you lab names Will vary from this
      
    • Hi!
      
      If you run get-help .\RegenerateBootImageWnPE10-v7.ps1 you should get a list of the Parameters and which Type is needed:
      
      RegenerateBootImageWinPE10-v7.ps1 [-BootImageName] <string> [-BootImageConsoleName] <string> [-BootImageConsoleDescription] <string> [-BootImageConsoleVersion] <str
      ing> [-OSArchitecture] <string> [-EnableDebugShell] <string> [-PxeEnabled] <string> [-OverwriteExistingImage] <string> [-UpdateDistributionPoints] <string> [<Common
      Parameters>]
      
      The Param-Block give you a Help-Message to each Parameter with !? - well this is BuiltIn into Powershell.
      
      But we will take the feedback and add a .SYNOPSIS-Block to give an additional help.
1 - 10 of 13 Items