Skip to main content
AutopilotOOBE with ConfigMgr: Autopilot CMD
  1. Posts/

AutopilotOOBE with ConfigMgr: Autopilot CMD

Michael Escamilla
Author
Michael Escamilla
Table of Contents

In my previous post, we talked about AutopilotOOBE and how to manually install and run the module.

But lets same ourselves some time and create a CMD file that can install and run the module for us.

Additional Information
#

This is straight from the documentation of AutopilotOOBE.

What are we going to do?
#

We’ll add a step to our ConfigMgr Task Sequence to create the CMD file.

Task Sequence Step

Create ‘Autopilot.cmd’
#

We can utilize the below script to create the ‘Autopilot.cmd’ file. The script will:

  • Set Execution Policy
  • Add PowerShell Scripts to the ‘Path’
  • Install the AutopilotOOBE PowerShell Module
    • In this script, we are specifically installing version 21.8.31.1
    • As of this writing, this is the newest version on PSGallery that has the ‘AssignedUser’ option
  • Start-AutopilotOOBE
#================================================
#   Set AutopilotOOBE CMD
#================================================
$SetCommand = @'
@echo off

:: Set the PowerShell Execution Policy
PowerShell -NoL -Com Set-ExecutionPolicy RemoteSigned -Force

:: Add PowerShell Scripts to the Path
set path=%path%;C:\Program Files\WindowsPowerShell\Scripts

:: Open and Minimize a PowerShell instance just in case
start PowerShell -NoL -W Mi

:: Install the latest AutopilotOOBE Module
start "Install-Module AutopilotOOBE" /wait PowerShell -NoL -C Install-Module -Name AutopilotOOBE -RequiredVersion 21.8.31.1 -Force -Verbose

:: Start-AutopilotOOBE
:: There are multiple example lines. Make sure only one is uncommented
:: The next line assumes that you have a configuration saved in C:\ProgramData\OSDeploy\OSDeploy.AutopilotOOBE.json
start "Start-AutopilotOOBE" PowerShell -NoL -C Start-AutopilotOOBE

exit
'@
$SetCommand | Out-File -FilePath "C:\Windows\Autopilot.cmd" -Encoding ascii -Force

Add this to the Task Sequence
#

Download the Full Task Sequence

  1. Add a ‘Run PowerShell Script’ step
    • This step needs to be after the ‘Start-OSDCloudGUI’ step
    • This is because the file needs to be created within the new OS
      Add Task Sequence Step
  2. Set the Execution Policy to Bypass
    Set the TS Step Execution Policy
  • Select ‘Enter PowerShell script:’
    • Then select ‘Edit Script…’

Add the PowerShell Script
4. Paste the script into the prompt, and select ‘OK’
Paste the PowerShell Script
Save the changes, Deploy the Task sequence if it isn’t already.

Run the Task Sequence
#

You should see the step run after the ‘Start-OSDCloudGUI’ step

Run the Task Sequence
Once you are at the OOBE screen

  1. (Shift + F10) to get the cmd
  2. Type:
autopilot
Run Autopilot

Success
#

Now your techs can save valuable time not having to manually type out the commands to install the AutopilotOOBE module.