In My Previous post,I blogged about SCCM Report list packages that do not use UNC path (i.e package Uses local Drive) and this is not good if you are migrating the packages from SCCM 2007 to Configuration Manager 2012.
After you get list of packages that use local drive,you will have to change them to UNC .
Note: This script will change the source path from Local drive(D:) to UNC path(\\servername\) for all the list of given packages at one Go.
For ex: Current pkg source path: D:\applications\adobe 9.2 Eng ,change to UNC: \\servername\applications\Adobe 9.2 Eng
If you have different UNC path for each package and not same what i have, modify the script.
You can either use custom Tools like package source changer from coretech OR Powershell or other scripts.
I wrote Simple Script that works only for Standard Software Distribution Packages but not for Software Update /OSD/ Driver packages.
Pipe the list of packages from the report to pkgs.txt.
strComputer = "SCCM Server name"
Set objfso = CreateObject ("Scripting.filesystemObject")
Set pkgs = objfso.OpenTextFile ("C:\pkgs.txt", 1)
Set outputList = objfso.OpenTextFile ("C:\outputList.txt", 2, True)
Do While Not pkgs.AtEndOfStream
pkgName = pkgs.ReadLine
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\SMS\site_CEN")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM SMS_Package WHERE PackageID = '" & pkgName & "'")
For Each objItem in colItems
' Wscript.Echo "PkgSourcePath: " & objItem.PkgSourcePath
outputList.WriteLine pkgName & vbTab & "Old Path"& vbTab & objItem.PkgSourcePath
tmp = replace((objItem.PkgSourcePath),"D:", "\\servername")
objItem.PkgSourcePath = tmp
outputList.WriteLine pkgName & vbTab & "New Path" & vbTab & objItem.PkgSourcePath
After you change the package source path,packages will start updating on all the Sites where ever it was targeted previously.So please be careful while doing this task because of network traffic.
Hope it helps!