Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neil-sabol/efb540bef4e435c4e753275e4b819d2c to your computer and use it in GitHub Desktop.
Save neil-sabol/efb540bef4e435c4e753275e4b819d2c to your computer and use it in GitHub Desktop.
# Specify the FQDNs of the source and destination distribution points
$sourceDP = "MEMCMDP1.contoso.com"
$destDP = "MEMCMDP2.contoso.com"
# Suppress error messages (usually because content already exists on the destination)
$ErrorActionPreference = "SilentlyContinue"
# Get all content from the source DP
# See https://learn.microsoft.com/en-us/powershell/module/configurationmanager/get-cmdeploymentpackage?view=sccm-ps
Get-CMDeploymentPackage -DistributionPointName $sourceDP | %{
[int]$currentContentObjectTypeID = $_.ObjectTypeID
$currentContentID = $_.PackageID
$currentContentName = $_.Name
# Use ObjectTypeID identify the type of content
# See https://learn.microsoft.com/en-us/mem/configmgr/develop/reference/core/servers/console/sms_objectcontentinfo-server-wmi-class
# Then, start distribution of the content to the destination DP
# See https://learn.microsoft.com/en-us/powershell/module/configurationmanager/start-cmcontentdistribution?view=sccm-ps#-inputobject
switch($currentContentObjectTypeID) {
2 { Get-CMPackage -Id $currentContentID | Start-CMContentDistribution -DistributionPointName $destDP }
14 { Get-CMOperatingSystemInstaller -Id $currentContentID | Start-CMContentDistribution -DistributionPointName $destDP }
18 { Get-CMOperatingSystemImage -Id $currentContentID | Start-CMContentDistribution -DistributionPointName $destDP }
19 { Get-CMBootImage -Id $currentContentID | Start-CMContentDistribution -DistributionPointName $destDP }
21 { }
23 { Get-CMDriverPackage -Id $currentContentID | Start-CMContentDistribution -DistributionPointName $destDP }
24 { Get-CMSoftwareUpdateGroup -Id $currentContentID | Start-CMContentDistribution -DistributionPointName $destDP }
31 { Get-CMApplication -Name $currentContentName | Start-CMContentDistribution -DistributionPointName $destDP }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment