You can remove an item from a deployment share using the Remove-Item cmdlet. The Remove-Item cmdlet uses the MDTProvider to remove a specific item, just as you can remove an item in the Deployment Workbench. If you want to remove multiple items in a deployment share using Windows PowerShell, see Automating Population of a Deployment Share.

Note   Removing an item that a task sequence uses causes the task sequence to fail. Ensure that an item is not referenced by other items in the deployment share prior to removing the item. Once an item is removed, it cannot be recovered.

To remove an item from a deployment share 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.   Verify that the MDT deployments that share Windows PowerShell drives are restored properly 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.

4.   Return a list of the items for the type of item for which you are wanting to view the properties using the Get-Item cmdlet, as shown in the following example:

Get-Item "DS001:\Operating Systems\*" | Format-List

In the previous example, a list of all the operating systems in the deployment share is displayed. The output is piped to the Format-List cmdlet so that the long names of the operating systems can be seen. For more information on how to use the Format-List cmdlet, see Using the Format-List Cmdlet. You could use the same process to return the list of other types of items, such as device drivers or applications.

Tip   You could have also used the dir command to view the list of operating systems instead of the Get-Item cmdlet.

5.   Remove one of the items listed in the previous step using the Remove-Item cmdlet, as shown in the following example:

Remove-Item -Path "DS002:\Operating Systems\Windows 8 in Windows 8 x64 install.wim"

In this example, the value of the Path parameter is the fully qualified Windows PowerShell path to the item, including the file name that was returned in the previous step.

You could use the same process to remove other types of items, such as device drivers or applications.

Note   Removing an item that a task sequence uses causes the task sequence to fail. Ensure that an item is not referenced by other items in the deployment share prior to removing the item.

Related Topics

Managing Items in a Deployment Share Using Windows PowerShell