Updating your deployment point programmatically

I was asked recently if it was possible to launch an "Update" and/or an "Update (files only)" in MDT via a script as my client did not want to open the MMC console just to update their Distribution Point.  Well, yes it is possible and here you have a PowerShell script that does it!

You'll need to have the .NET Framework, WAIK and PowerShell installed on the computer you plan to run these scripts.  Also, you'll need to modify the scripts to add the correct path of the loaded assemblies.

[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.ConfigManager.dll")
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Windows AIK\Tools\Image Manager\Microsoft.ComponentStudio.Common.dll")
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Windows AIK\Tools\Image Manager\Microsoft.ComponentStudio.ComponentPlatformImplementation.dll")
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Windows AIK\Tools\Image Manager\Microsoft.ComponentStudio.ComponentPlatformInterface.dll")
[System.Reflection.Assembly]::LoadFrom("C:\Program Files\Windows AIK\Tools\Image Manager\Microsoft.ComponentStudio.Serializer.dll")

$manager = [Microsoft.BDD.ConfigManager.Manager]
$Deploymanager = $manager::Deploymanager
$newItem = $Deploymanager[" <Place your DP GUID Here> "]
$newItem.Generate("x86", "c:\temp\logupdate.log”, $false)

 

In order to retrieve the GUID of your Deployment Point you can use the following script, and then add the GUID returned to the script above.

[System.Reflection.Assembly]::LoadFile("C:\Program Files\Microsoft Deployment Toolkit\Bin\Microsoft.BDD.ConfigManager.dll")
$manager = [Microsoft.BDD.ConfigManager.Manager]

$manager::InstallPath
$manager::WaikPath
$manager::TempPath

write-host "Deploy:"
$manager::DeployManager.GetDataTable()

 

If you want to update only the configuration files, make sure to change the following line to:

$newItem.Generate("x86", "c:\temp\logupdate.log”, $true)

                                                                                                                                                                         

When the last parameter is set to $false the script will update all files, whereas if it is set to $true the script will update only the configuration files.  It goes without saying that this is not an official script of MDT, nor Microsoft, so use it at your own risk!