You can automate the process of updating operating system service packs using Windows PowerShell when you have source media that include the service pack, such as having a DVD that has Windows 7 with SP1 already integrated.

For this method, the operating system source media with the service pack is copied over the existing operating system files without the service pack in the deployment share using Windows PowerShell.

To automate the application of operating system service packs from updates source media using Windows PowerShell

1.   Load the MDT Windows PowerShell snap-in as described in Loading the MDT Windows PowerShell Snap-In.

2.   Ensure that the MDT deployments that share Windows PowerShell drives are restored using the Restore-MDTPersistentDrive cmdlet, as shown in the following example:

Restore-MDTPersistentDrive -Verbose

Note   If the MDT deployments that share Windows PowerShell drives are already restored, you will receive a warning message indicating that the cmdlet is unable to restore the drive.

3.   View the list of MDT deployments share Windows PowerShell drives, one for each deployment share, using the Get-PSDrive cmdlet, as shown in the following example:

Get-PSDrive -PSProvider Microsoft.BDD.PSSnapIn\MDTProvider

The list of Windows PowerShell drives provided using the MDTProvider are listed, one for each deployment share.

4.   Remove the folder for the existing operating system from the deployment share using the Get-ChildItem and Remove-Item cmdlets, as shown in the following example:

Get-ChildItem “DS002:\Operating Systems\Windows 7” –recurse | Remove-Item –recurse –force

In this example, DS002: is the name of a Windows PowerShell drive returned in step 3.

5.   Copy the contents of the operating system source files that have the service pack integrated using the Copy-Item cmdlet, as shown in the following example:

Copy-Item "E:\*" -Destination "DS002:\Operating Systems\Windows 7"-Recurse -Force

In this example, the operating system source files are on drive E, and DS002: is the name of a Windows PowerShell drive returned in step 3.

6.   Update any MDT deployment media based on deployment share using Update-MDTMedia cmdlet.

For more information about how to update MDT deployment media based on deployment share using Update-MDTMedia cmdlet, see Updating Deployment Media Using Windows PowerShell.

Related Topics

Automating the Application of Operating System Service Packs in Deployment Shares