This section describes the Add-MDTPersistentDriveWindows 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.
Add-MDTPersistentDrive [-Name] <String> [[-InputObject] <PSObject>] [<CommonParameters>]
This cmdlet adds an existing Windows PowerShell drive created using the MDTProvider to a 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 you create or open a deployment share in 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.
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? |
2 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? |
3 and Named |
Default value |
– |
Accept pipeline input? |
True (ByValue) |
Accept wildcard characters? |
False |
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
This cmdlet outputs a PSObject type object for the Windows PowerShell drive object was added to the list of persisted drives.
This cmdlet also outputs a String type object if the Verbose common parameter is included.
Example 1
Add-MDTPersistentDrive –Name DS001
Description
This example adds the deployment share with the Windows PowerShell drive name of DS001 to the list of persisted drives.
$MDTPSDrive = New-PSDrive -Name "DS001" -PSProvider "MDTProvider" –Root "C:\DeploymentShare$" -Description "MDT Deployment Share" -NetworkPath \\WDG-MDT-01\DeploymentShare$ -Verbose
Add-MDTPersistentDrive –InputObject $MDTPSDrive
Description
This example adds the Windows PowerShell drive name DS001, created by the New-PSDrive cmdlet, to the list of persisted MDT drives using the $MDTPSDrive variable.
New-PSDrive -Name "DS001" -PSProvider "MDTProvider" –Root "C:\DeploymentShare$" -Description "MDT Deployment Share" -NetworkPath \\WDG-MDT-01\DeploymentShare$ -Verbose | Add-MDTPersistentDrive –Verbose
Description
This example adds the Windows PowerShell drive name DS001, created by the New-PSDrive cmdlet, to the list of persisted MDT drives by piping the newly created Windows PowerShell drive object to the Add-MDTPersistentDrive cmdlet.
Related Topics