Archive for May, 2009

Moving SCCM Packages and Drivers Source Location

I had a situation recently where a server that had the source shares for my Packages and Drivers had to be decommissioned. This initially seemed like an simple task of updating the source location in each package to the new server. However after realising that there were a lot of packages and about 400 drivers I sought a better way. Powershell to the rescue!

The following block of Powershell gets all the drivers and does a search and replace on the server name.

1
2
3
4
$drivers = Get-WmiObject SMS_Driver -Namespace root\SMS\site_LNK
$drivers | ?{$_.ContentSourcePath -like "\\creekserver\*"} | `
%{$_.ContentSourcePath = $_.ContentSourcePath -replace "creekserver", "PRI-SCCM-V01"; $_.Put()}

I did the same for packages:

1
2
3
4
5
6
$packages = Get-WmiObject SMS_Package -Namespace root\SMS\site_LNK
$packages | ?{$_.PkgSourcePath -like "*creekserver*"} | `
%{$_.PkgSourcePath = $_.PkgSourcePath -replace "creekserver","PRI-SCCM-V01"; $_.Put()}
$packages | %{$_.RefreshPkgSource}

Enjoy!

Read more