MDT New PC TS
Last updated
OSConfig can be added to an MDT Task Sequence in a few steps.
Once you have OSConfig properly configured, copy it to your MDT Deployment Share. I prefer to keep mine in the following location
<DeploymentShare>\OSDeploy\OSConfig\*
Make sure that your Format Partition steps use OSDisk for your Windows Partition

Edit your task Sequence and in the Postinstall Phase, add a Run Command Line step right before Restart computer called Copy OSConfig with the following Command line

In the Options tab, add a 1 to the Success codes and check Continue on error

I add a Run Command Line step to open Notepad with 'Continue on Error' during testing. This allows the Task Sequence to pause so I can take a VM Snapshot. You must open Notepad with 'cmd /c', otherwise Notepad will be hidden. Use the following Command Line

Add a new RunSynchronousCommand entry to your Unattend.xml file at <DeploymentShare>\Control\<TaskSequenceID>\Unattend.xml
When complete, it should look like this:

Save and close it.
If you added Notepad to pause the Task Sequence, take a VM Snapshot. Close Notepad and the Task Sequence will continue.

OSConfig will be copied to OSDisk and the computer will restart. During the Specialize Phase (OOBE), OSConfig will execute. Depending on how you have your Child scripts set to process, you can maximize the minimized Window.

In the image below, the Appx Packages are being removed

If everything is configured properly, your customizations should show up as soon as the Task Sequence gets to the Desktop



You can even verify Local Policy to make sure that all the GPOs were applied

Last updated
cmd /c robocopy "%DeployRoot%\OSDeploy\OSConfig" %OSDisk%\ProgramData\OSConfig *.* /mir /ndl /nfl /r:1 /w:1 /xj /z<RunSynchronousCommand wcm:action="add"> <Description>OSConfig</Description> <Order>5</Order> <Path>PowerShell.exe -ExecutionPolicy Bypass -File %ProgramData%\OSConfig\OSConfig.ps1</Path></RunSynchronousCommand>