# MDT New PC TS

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\*
```

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLXs-wOWxBb7RPJJoh3%2F2018-09-03_23-35-27.png?alt=media\&token=a761cb44-33d9-4220-bacf-584cd7762929)

## Verify OSDisk <a href="#verify-osdisk" id="verify-osdisk"></a>

Make sure that your Format Partition steps use OSDisk for your Windows Partition

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLXsSiqKDqNzIyqo6nj%2F2018-09-03_23-32-22.png?alt=media\&token=d6a43c78-30fc-4511-bb1c-4bd334a37aeb)

## Task Sequence Copy OSConfig Step <a href="#task-sequence-copy-osconfig-step" id="task-sequence-copy-osconfig-step"></a>

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**

```
cmd /c robocopy "%DeployRoot%\OSDeploy\OSConfig" %OSDisk%\ProgramData\OSConfig *.* /mir /ndl /nfl /r:1 /w:1 /xj /z
```

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLY1HAE8zpLZRyUH_IE%2F2018-09-03_23-43-05.png?alt=media\&token=cad062e4-9739-48ae-b20a-7acebb4b85f2)

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

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLY1QEp2io6iivUdBJK%2F2018-09-03_23-41-56.png?alt=media\&token=3d380fb5-1552-4ee3-a1ba-05453b45f83e)

## Task Sequence Pause Step <a href="#task-sequence-pause-step" id="task-sequence-pause-step"></a>

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

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLXtKdgbK7rw6XiBqA_%2F2018-09-03_23-44-05.png?alt=media\&token=66a6606f-d0a0-46e4-9f5c-075e629f66e4)

## Edit the Task Sequence Unattend.xml <a href="#edit-the-task-sequence-unattend-xml" id="edit-the-task-sequence-unattend-xml"></a>

Add a new RunSynchronousCommand entry to your Unattend.xml file at \<DeploymentShare>\Control\\\<TaskSequenceID>\Unattend.xml

```
<RunSynchronousCommand wcm:action="add">  <Description>OSConfig</Description>  <Order>5</Order>  <Path>PowerShell.exe -ExecutionPolicy Bypass -File %ProgramData%\OSConfig\OSConfig.ps1</Path></RunSynchronousCommand>
```

When complete, it should look like this:

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LJHnUmulgpoKqJ0TzIb%2F-LJHrSd_gUc_gqRlYUo3%2F2018-08-07_0-27-35.png?alt=media\&token=bc91dfc3-b2d6-4528-94b7-fd15429d7184)

Save and close it.

## Run the Task Sequence <a href="#run-the-task-sequence" id="run-the-task-sequence"></a>

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

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLY3WcOtnJrXD-tvDLR%2F2018-09-04_0-31-44.png?alt=media\&token=1fbdd367-26f3-42c4-a91a-795b324d9c22)

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.

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLY46qVInqQjVQkckza%2F2018-09-04_0-35-03.png?alt=media\&token=25897e1b-36a9-4661-bd70-a3857d8374c5)

In the image below, the Appx Packages are being removed

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLXqhd28iwIvmxcL-cW%2F-LLY4NBB07qiuNmNh_w9%2F2018-09-04_0-35-16.png?alt=media\&token=46395558-6b59-4fdd-96a1-4dd04b625e92)

## Complete <a href="#complete" id="complete"></a>

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

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLY4kn1_XoWA1FXYszA%2F-LLY6wmoaVY5XokEavTN%2F2018-09-04_0-47-58.png?alt=media\&token=d9b326f7-1fae-49ab-a230-b71aea24d80a)

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLY4kn1_XoWA1FXYszA%2F-LLY727BKY4d1he-GwmT%2F2018-09-04_0-47-15.png?alt=media\&token=af7da54e-4121-4343-b964-d04e0785f76f)

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLY4kn1_XoWA1FXYszA%2F-LLY74cNFePbx044T5gL%2F2018-09-04_0-47-39.png?alt=media\&token=0fb3dc4c-dcfb-4704-bed7-814e8678b27c)

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

![](https://blobscdn.gitbook.com/v0/b/gitbook-28427.appspot.com/o/assets%2F-LDKRxGiKLYjW1gana2O%2F-LLY4kn1_XoWA1FXYszA%2F-LLY7OtJCWGPPt5cT1MI%2F2018-09-04_0-50-00.png?alt=media\&token=ec93f830-0d0d-4ed6-88ad-69b9fc3dd1a3)

​
