Beyond Basic Windows 10 Provisioning Packages

Windows 10 and it’s new provisioning packages presents an exciting addition to the traditional way of applying settings, even including applications, to a system during operating system deployment. However, this is a first release, which will evolve over time. Things I hope will be added are better integration with normal enterprise deployment of Windows, e.g. with solutions like MDT and/or ConfigMgr, and removing the ties of some of it’s features to setup.exe and windows setup audit mode. Both components that are not used, and should not be used, during OSD (in my not so humble opinion 🙂 ). That being said, the feature does provide interesting new ways of doing things for deployment, and if you plan to do Windows 10 deployments, you should know about it.

Provisioning Packages

If you simplify it, a lot, you can think of provisioning packages as an uber-version of the unattend.xml, but with other settings, and with the ability to attach file assets. These packages are only for Windows 10, and they are authored by the Windows Imaging and Configuration Designer (WICD) tool, which is a part of the Windows ADK 10.

The official documentation for Provisioning Packages and WICD, including some nice step-by-step guides, is found here.

Anyway, the packages that you create, ends with the PPKG extension, but they are really just WIM files, meaning you can mount them using ImageX/DISM/7-Zip and even do changes on the fly to them (even though that never was the intention, and is not supported either 🙂 ). Here is the content in a provision package that sets the Microsoft Edge home page.

Note: The 10240 version of WICD is quite slow, and will often go to “not responding” when using it. But simply give it some time and it normally comes back.

image
Sample package.

image
Sample Setting.

Using Provisioning Packages instead of thick Reference Images

Another way to create a very special provisioning package, is to take a reference image that you prepared with MDT, but instead of having MDT sysprep and capture the image, you use Scanstate with the new /apps switch (Windows 10 only), to capture apps and customizations into a smaller package. That package can then be applied during deployment.

Note: Does this really replace the traditional build and capture process? Well I’m not there yet, but at least I think this interesting enough to play around with.

Creating a provisioning package that contains desktops apps

To create a provisioning package that contains desktops apps, you not only need the USMT files, but also Windows Setup files that are installed by the Windows ADK 10. If you don’t copy the Windows Setup Files, you get the following error running scanstate: Scanstate return code: 29. So the steps are the following:

  1. On your reference computer, in this case for Windows 10 x64, first create a C:\Packages folder (to be used later). Then create a C:\USMT folder, and copy the USMT files from C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\User State Migration Tool\amd64 to it.  
  2. After copying the USMT files, you also need to copy the Windows setup files. This since the /apps switch for Scanstate requires files not included in the USMT folder. To add the needed files, simply copy the content of the C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Windows Setup\amd64\Sources folder to C:\USMT. Replace any existing files.

    image
    The C:\USMT folder after Windows Setup files being added, for example the hwcompat.dll which is used.    

  3. Create the package by starting an elevated PowerShell prompt, navigate to the C:USMT folder, and run the following command:

    .\scanstate.exe /apps /ppkg C:\PackagesREF001.ppkg

image
Running the capture command.

Note: When using Scanstate with the /apps option, it will capture desktop Windows applications, plus any other files and folders inside of the following folders: Windows, Program Files, Program Files (x86), ProgramData, and Users. Capturing files and folders outside these folders is not yet supported.

Applying a provisioning package that contains desktops apps

Even though Scanstate is used to create the package, again only setup.exe can apply it (e.g. you can’t use Loadstate as you normally would). This is because the blob in the PPKG can only be processed by Setup, and Setup process it in various phases to lay down the app files and set the registry keys. Luckily WICD can create a media for you that automatically contains both Windows 10 and the captured package. To create it, you do the following:

  1. Copy a Windows 10 media to a folder, in my case I copied the content of the Windows 10 ISO to C:\Setup\Windows 10 Enterprise x64 build 10240.  
  2. Start WICD and create a new Windows image customization, give the project a name, and select the The Windows image is based on a Windows Image (WIM) file option.  
  3. Browse and select the install.wim file.

    image
    Browsing to the install.wim file.  

  4. Import the previously created provisioning package

    image
    Importing the package captured via Scanstate.      

  5. Create the C:\Media folder, and in WICD, in the Create menu, select to create a Clean Install media.

    Note: Production media is meant to be used in OEM manufacturing, so the media is tailored towards the process that it allows option like compact, audit mode, etc. and some optimizations to reduce factory floor time. The clean install media is more straight forward that the installation ends after OOBE and expects the user will continue to desktop. The media created is for clean installations only, not for the Inplace upgrade scenario.     

  6. Select the WIM option, and select No to enable compact OS.   
  7. Do not configure audit mode, and select either to save to a folder (I selected to save to a folder), or create a bootable USB drive. Then click Build.

    image
    The Build options page.      

  8. To test the setup, you can simply create a bootable ISO, and mount it in a virtual machine. Use the following PowerShell script to create a bootable ISO with EUFI support.
# Create a bootable ISO of Windows 10. The script assumes you installed Windows ADK 10 in the default location.
  
$MediaFolder = 'C:\Media'
$ISOFolder = 'C:\ISO'
$ISOFile = "$ISOFolder\Windows10_build10240_with_apps.iso"
$ToolsPath = "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg"
 
Write-Output "Checking for oscdimg.exe"
If (Test-Path $ToolsPath\oscdimg.exe){
    Write-Output "Oscdimg.exe found, OK, continuing..."
    Write-Output ""
    }
Else {
    Write-Output "Oupps, cannot find Oscdimg.exe. Make sure it is copied to $ToolsPath. Aborting"
    Break
}
 
Write-Output "Checking for Media folder"
If (Test-Path C:\Media\setup.exe){
    Write-Output "Installation media found, OK, continuing..."
    Write-Output ""
    }
Else {
    Write-Output "Oupps, cannot Installation media. Make sure it is copied to $MediaFolder. Aborting"
    Break
}
 
Write-Output "Checking for ISO folder"
If (Test-Path $ISOFolder){
    Write-Output "ISO folder found, OK, continuing..."
    Write-Output ""
    }
Else {
    Write-Output "ISO folder not found, creating $ISOFolder folder"
    New-Item $ISOFolder -ItemType Directory
}
 
  
# Create the Windows 10 ISO
$BootData='2#p0,e,b"{0}"#pEF,e,b"{1}"' -f "$ToolsPath\etfsboot.com","$ToolsPath\efisys.bin"
  
$Proc = Start-Process -FilePath "$ToolsPath\oscdimg.exe" -ArgumentList @("-bootdata:$BootData",'-u2','-udfver102',"$MediaFolder","$ISOFile") -PassThru -Wait -NoNewWindow
if($Proc.ExitCode -ne 0)
{
    Throw "Failed to generate ISO with exitcode: $($Proc.ExitCode)"
}

Background info, on the media

If you start to look around on the Windows 10 media that is created, you’ll find that the only real difference is that the package is added to the C:\Media\sources\ProvisioningPackages folder, and that there is a Autounattend.xml file added to the C:\Media\sources folder. To further automate the OOBE process, which you should, you simply configure the Autounattend.xml to do so.

image

The C:\Media\sources\ProvisioningPackages folder after using WICD to create a media.

image

The default Autounattend.xml created by WICD.

image

Booting on the created media.

image

The new machine, deployed including the apps that were captured.

Happy Deployment, Johan

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Claudio
Claudio
9 months ago

Hey Johan, Thanks for this write-up. Because of this article, I started to research provisioning package as a means to trying to replace our Reference image. Using provisioning package and WIM Witch (Windows WIM/ISO off-line servicing). I think I have succeeded, no more thick images. We don’t have a complicated setup in work area. All my Windows customization were provisioning packages, deployed on SCCM, using DISM on a command line task. 1.     Set desktop & Lock screen image 2.     Replace the user Account images 3.     Install 3 web browsers This was done on Windows 10 Ent v1909 I added the Start Menu Layout… Read more »

Will
Will
1 year ago

Hi Johan,

Is there an option to set the default screen resolution in ICD?
My alternate method was a ProcMon capture on systemsettings.exe and plug that into a task sequence.

Thanks.


>