|Microsoft Deployment Toolkit
Creating a Deployment Share Using Windows PowerShell
You can create deployment shares using the MDT Windows PowerShell cmdlets. The root folder for the deployment share is created and shared using standard Windows PowerShell cmdlets and calls to Windows Management Instrumentation (WMI) class commands. The deployment share is populated using the MDTProvider Windows PowerShell provider and the New‑PSDrive cmdlet. The MDTProvider Windows PowerShell drive is persisted using the Add-MDTPersistentDrive cmdlet.
To prepare a deployment share using the MDT Windows PowerShell cmdlets
1. Load the MDT Windows PowerShell snap-in as described in Loading the MDT Windows PowerShell Snap-In.
2. Create the folder that will be the root of the new deployment share using the New-Item cmdlet, as shown in the following example and described in Using the New-Item Cmdlet:
New-Item "C:\MDTDeploymentShare$" -Type directory
The cmdlet displays the successful creation of the folder.
3. Share the folder created in the previous step using the WMI win32_share class as sown in the following example:
The call to the win32_share class returns the results of the call. If the value of ReturnValue is zero (0), then the call was successful.
4. Specify the new shared folder as a deployment share using the New‑PSDrive cmdlet, as shown in the following example:
New-PSDrive -Name "DS002" -PSProvider "MDTProvider" -Root "C:\MDTDeploymentShare$" -Description "MDT Deployment Share Created with Cmdlets" -NetworkPath "\\WDG-MDT-01\MDTDeploymentShare$" -Verbose
The cmdlet automatically starts creating the deployment share and copying the template information into the new deployment share. Upon completion of the copy process, the cmdlet displays the information for the new deployment share.
Note The value provided in the Name parameter (DS002) must be unique and cannot be the same as an existing deployment share Windows PowerShell drive.
5. Verify that the appropriate deployment share folders have been created using the dir command, as show in the following example:
The list of default folders in the root of the deployment share is displayed.
6. Add the new deployment share to the list of persisted MDT deployment shares using the Add-MDTPersistentDrive cmdlet, as shown in the following example:
Add-MDTPersistentDrive -Name "DS002" -InputObject $NewDS ‑Verbose
In this example, the $NewDS variable is used to pass the Windows PowerShell drive object for the new deployment share to the cmdlet.
New-PSDrive -Name "DS002" -PSProvider "MDTProvider" -Root "C:\MDTDeploymentShare$" -Description "MDT Deployment Share Created with Cmdlets" -NetworkPath "\\WDG-MDT-01\MDTDeploymentShare$" -Verbose | Add-MDTPersistentDrive -Verbose
In the previous example, the Windows PowerShell pipeline provides both the Name and InputObject parameters.