I’ve recently seen people asking on forums about how to modify the source settings of SCCM packages when migrating software installation files from an old server to a new one. Obviously manually updating packages is an option, but this will take time.. so this is achieved very easily by running the PowerShell code below

<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.128
Created on: 31/10/2016 14:13
Created by: Maurice.Daly
Organization:
Filename: UpdatePkgSource.ps1
===========================================================================
.DESCRIPTION
Updates the source location for SCCM packages and update your distribution points
Provided as is with no support. Run at your own risk.
#>

$OldSource = "\\YOUROLDSERVER\PACKAGESOURCE"
$NewSource = "\\YOURNEWSERVER\PACKAGESOURCE"

foreach ($Package in (Get-CMPackage | Where-Object { $_.PkgSourcePath -like "*$OldSource*" }))
{
Write-Host "Modifying $($Package.name) with new location $NewSource"
$UpdatedSource = $Package.PkgSourcePath -replace $OldSource, $NewSource
# Update source location of package
Set-CMPackage -id $Package.ID -Path $UpdatedSource
# Force update of distribution points
Get-CMPackage -id $Package.ID | Update-CMDistriubtionPoint
}
Maurice Daly
Maurice has been working in the IT industry since 1999. Technology focus includes Active Directory, Group Policy, Hyper-V, Windows Deployment (SCCM & MDT) and Office 365.

Maurice is a Microsoft MVP since 2017 in the area of Enterprise Mobility

(236)

There are no comments.

Leave a Reply