Microsoft Deployment Toolkit
Documentation Library Delete a Folder in a Deployment Share Using Windows PowerShell |
To delete a folder in 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. View the list of MDT deployments that share Windows PowerShell drives, one for each deployment share, using the Get-PSDrive cmdlet as follows:
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. Delete (remove) a folder named Windows_8 in the Operating Systems folder in a deployment share using the mkdir command, as shown in the following example:
rmdir "DS002:\Operating Systems\Windows_8"
In this example, DS002: is the name of a Windows PowerShell drive returned in step 3.
5. Verify that the folder is removed correctly by typing the following command:
dir "DS002:\Operating Systems"
The Windows_8 folder is no longer displayed in the list of folders in the Operating Systems folder.
6. Delete (remove) a folder named Windows_7 folder in the Operating Systems folder in a deployment share using the Remove-Item cmdlet, as shown in the following example:
Remove-Item "DS002:\Operating Systems\Windows_7"
The cmdlet displays the successful removal of the folder.
7. Verify that the folder is created correctly by typing the following command:
dir "DS002:\Operating Systems"
The Windows_7 folder is no longer displayed in the list of folders in the Operating Systems folder.
Related Topics