Using PSD to Deploy Windows 11 into OOBE (Autopilot)

In our Online Community we recently got a question about configuring PSD to deploy Windows 11 in a way, so the setup ended in Windows Out of Box Experience (OOBE). This is commonly used to test Autopilot scenarios, but the same technique can be used for other setup testing. This post shows you how to configure a PSD task sequence for this scenario.

PSD / Task Sequence Cleanup and the Specialize Pass

Before a device can enter the OOBE pass (phase) of setup during a PSD deployment, it must undergo some cleanup. The catch is that you cannot clean up the task sequence information while it's running.

Well, that's when the Specialize pass of Windows setup is handy. You configure the task sequence to copy a cleanup script to the device in the WinPE phase and then configure the unattend.xml file to run the cleanup script directly after reboot.

Below are the steps to configure the task sequence, but first you need to download the cleanup script and the unattend.xml template that runs the

Step 1 – Add Cleanup Script

Download the cleanup script and save it in your deployment share scripts folder.

Cleanup script added.

Step 2 – Configure the Task Sequence

Below are the steps to configure the task sequence, I recommend creating a new task sequence for testing.

1. Create a new Task Sequence using the PSD Client template. I named my task sequence Windows 11 Enterprise x64 23H2 – OOBE.

2. Edit the new Task Sequence, and in the Install Operating System group, remove the Restart Computer action (last action in that group).

3. Remove all actions in the Setup Operating System group.

4. Rename the Setup Operating System group to Prepare for Autopilot.

5. In the Prepare for Autopilot group, add a Run Command Line action with the following settings:

Name: Copy PSD cleanup script
Command line: xcopy %SCRIPTROOT%\PSDCleanupForAutopilot.ps1 %OSVOLUME%:\Windows\Temp

    The configured task sequence

    Step 3 – Modify the Unattend.xml

    To have Windows setup run the cleanup script after rebooting from WinPE, you need to modify the unattend.xml file:

    1. Download the sample unattend.xml file.

    2. In the deployment share\control\<task sequence id> folder for your new task sequence, rename the existing unattend.xml to unattend.bak.

    3. Copy the sample unattend.xml file to the deployment share\control\<task sequence id> folder.

    Unattend.xml sample file copied.

    Step 4 – Deploy a Machine

    The final step is to deploy a machine with your new task sequence. After deploying the Windows 11 image and rebooting, you will find the machine in OOBE.

    Machine in OOBE

    Troubleshooting and Testing

    Running scripts in the Specialize pass of Windows setup leaves little room for error since setup will just continue no matter what. A useful tip when testing or developing a script for the Specialize pass is to modify the unattend.xml only to launch a PowerShell prompt. From that PowerShell prompt, you can run the script interactively or launch your favorite script editor and make changes on the fly.

    In the unattend.xml, change the command to: cmd /c start "PowerShell" /wait PowerShell.exe

    PowerShell prompt for troubleshooting or testing.
    About the author

    Johan Arwidmark

    0 0 votes
    Article Rating
    Subscribe
    Notify of
    guest
    13 Comments
    Newest
    Oldest Most Voted
    Faruk
    Faruk
    8 months ago

    Hello,

    Can you support me if any documentation/blog have updated for this from scratch how we can go ahead with Autopilot enrollment using MDT and with WDS and only have manual registration.

    i just want here On Del Machines whenever i am using the Dell machine and vanilla OS (Win11 24H2) then every time facing BSOD error on it.

    Christoph Wijns
    Christoph Wijns
    1 year ago

    Johan I don't quiet understand you call a cleanup file in unattend which is copied afterwards ?
    I always get a error task sequence failed – I know that you're nothing with this error but maybe you can help me out 😉

    Last edited 1 year ago by Christoph Wijns
    Lukas
    Lukas
    1 year ago

    Hi Johan, can you please give me a hint, how to use this MDT TS directly in SCCM?

    Rashed k
    Rashed k
    1 year ago

    Hi Johan, I created a task sequence and copied your TS.xml along with other files mentioned in this post in MDT to achieve OOBE for Autopilot immediately after the OS installation. I followed your guide, but I encountered the following failure: Error Summary: Failure: Please review the log files to determine the cause of the problem. During the deployment process, 8 errors and 4 warnings were reported. Error Details: FAILURE (Err 53): Copy File: E:\MININT\unattend.xml to E:\Windows\Panther\Unattend.xml – File not found. FAILURE (5627): Run DISM.exe LiteTouch deployment failed: Return Code = -2147467259 (0x80040005) Failed to save environment: Error Code 80070057… Read more »

    Rashed k
    Rashed k
    1 year ago
    Reply to  Rashed k

    Thanks, Johan! I'm not using the PSD extended deployment share. I simply copied the files PSDCleanupForAutoPilot.ps1 and PSDConfigure.ps1 into the Scripts folder. Is the PSD extended deployment share necessary for this to work?

    Robert
    Robert
    1 year ago

    Do you believe there would there be any issues with creating a custom script that runs the Get-WindowsAutoPilotInfo -Online command (as an app) from unattended.xml, followed by the cleanup process you provided? My goal is to automate hardware hash collection for devices that haven't been uploaded to Intune, ensuring they are registered. Let me know if you foresee any challenges with this approach.

    Christoph Wijns
    Christoph Wijns
    1 year ago
    Reply to  Robert

    Have you achieved this approach ?


    >