The MDT Windows PowerShell cmdlets allow you to manage individual items. However, by using some of the scripting features in Windows PowerShell, the cmdlets can be used to automate the population of a deployment share.

For example, an organization may need to deploy multiple deployment shares for different business units, or an organization may provide operating system deployment services for other organizations. In both of these examples, the organizations need the ability to create and populate deployment shares that are configured consistently.

One method for managing multiple items would be to use a comma-separated values (CSV) file that contains a list of all the items you want to manage in a deployment share using the Import-CSV cmdlet.

The following is an excerpt of a Windows PowerShell script to import a list of applications based on information in a .csv file using the Import-CSV, ForEach-Object, and Import-MDTApplication cmdlets:

$List=Import-CSV "C:\MDT\Import-MDT-Apps.csv"

ForEach-Object ($App in $List) {

Import-MDTApplication –path $App.ApplicationFolder -enable "True" –Name $App.DescriptiveName –ShortName $App.Shortname –Version $App.Version –Publisher $App.Publisher –Language $App.Language –CommandLine $App.CommandLine –WorkingDirectory $App.WorkingDirectory –ApplicationSourcePath $App.SourceFolder –DestinationFolder $App.DestinationFolder –Verbose

}

In this example, the C:\MDT\Import-MDT-Apps.csv file contains a field for each variable necessary to import an application. For more information about how to create a .csv file for use with the Import-CSV cmdlet, see Using the Import-Csv Cmdlet.

You can use this same method to import operating systems, device drivers, and other items in a deployment share by performing the following steps:

1.   Create a .csv file for each type of deployment share item that you want to populate.

For more information about how to create a .csv file for use with the Import-CSV cmdlet, see Using the Import-Csv Cmdlet.

2.   Create a Windows PowerShell script file that will be used to automate the population of the deployment share.

For more information about how to create a Windows PowerShell script, see Scripting with Windows PowerShell.

3.   Create any prerequisite folder structure required in the deployment share prior to importing the deployment share items.

For more information, see Managing Deployment Share Folders Using Windows PowerShell.

4.   Add the Import-CSV cmdlet line for one of the .csv files created in step 1.

For more information on the Import-CSV cmdlet, see Using the Import-Csv Cmdlet.

5.   Create a ForEach-Object cmdlet loop that processes each item from the .csv file referenced in the Import-CSV cmdlet in the previous step.

For more information on the ForEach-Object cmdlet, see Using the ForEach-Object Cmdlet.

6.   Add the corresponding MDT cmdlet for importing the deployment share items inside the ForEach-Object cmdlet loop created in the previous step.

For more information on the MDT cmdlets used for importing items into a deployment share, see Import an Item into a Deployment Share.

Related Topics

Managing MDT Using Windows PowerShell