This section describes the Remove-MDTPersistentDriveWindows Windows PowerShell cmdlet. Run this cmdlet from a Windows PowerShell console that has the MDT PowerShell snap-in loaded. For more information on how to start a Windows PowerShell console that has the MDT PowerShell snap-in loaded, see Loading the MDT Windows PowerShell Snap-In.

Syntax

Remove-MDTPersistentDrive [-Name] <String> [[-InputObject] <PSObject>] [<CommonParameters>]

Description

This cmdlet removes an existing Windows PowerShell drive created using the MDTProvider from the list of drives that are persisted in the Deployment Workbench or in a Windows PowerShell session using the Restore-MDTPersistentDrive cmdlet. This cmdlet is called when a deployment share is closed in (removed from) the Deployment Workbench.

Note   The list of persisted MDTProvider drives is maintained on a per-user based in the user profile.

The list of persisted MDTProvider drives can be displayed using the Get-MDTPersistentDrive cmdlet. An MDTProvider drive can be added to the list of persisted drives using the Add-MDTPersistentDrive cmdlet.

Parameters

This subsection provides information about the various parameters that can be used with the Add-MDTPersistentDriveWindows cmdlet.

-Name <String>

Specifies the name of a Windows PowerShell drive created using the MDT provider and corresponds to an existing deployment share. The name was created using the New-PSDrive cmdlet and specifying the MDTProvider in the PSProvider parameter.

For more information on how to create a new Windows PowerShell drive using the MDTProvider and how to create a deployment share using Windows PowerShell, see the section Creating a Deployment Share Using Windows PowerShell in the MDT document, Microsoft Deployment Toolkit Samples Guide.

 

Parameter

Value

Required?

True

Position?

1 and Named

Default value

None

Accept pipeline input?

True (ByValue)

Accept wildcard characters?

False

 

-InputObject <PSObject>

This parameter specifies a Windows PowerShell drive object that was created earlier in the process. Enter a PSObject object, such as one generated by the New-PSDrive cmdlet.

 

Parameter

Value

Required?

False

Position?

2 and Named

Default value

Accept pipeline input?        

True (ByValue)

Accept wildcard characters?

False

 

<CommonParameters>

This cmdlet supports the following common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see the topic, “about_CommonParameters,” which you can access by typing the following command, and then pressing ENTER:

Get-Help about_CommonParameters

Outputs

This cmdlet provides no outputs.

Example 1

Remove-MDTPersistentDrive –Name "DS001:"

Description

This example removes the deployment share with the Windows PowerShell drive name of DS001 from the list of persisted drives.

Example 2

$MDTPSDrive = Get-PSDrive | Where-Object {$_.Root -eq "C:\DeploymentShare" -and $_.Provider -like "*MDTProvider"}

Remove-MDTPersistentDrive –InputObject $MDTPSDrive

Description

This example removes the deployment share at C:\DeploymentShare$ from the list of persisted drives. The Get‑PSDrive and Where-Object cmdlets are used to return the MDT persisted Windows PowerShell drive to the Remove-MDTPersistentDrive cmdlet using the $MDTPSDrive variable. For more information on the Where-Object cmdlet, see Using the Where-Object Cmdlet. For more information on the Get-PSDrive cmdlet, see Using the Get-PSDrive Cmdlet.

Related Topics

MDT Windows PowerShell Cmdlets