Last active
November 7, 2022 22:17
-
-
Save neil-sabol/efb540bef4e435c4e753275e4b819d2c to your computer and use it in GitHub Desktop.
See https://blog.neilsabol.site/post/sccm-system-center-copy-clone-content-between-distribution-points/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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