I'm looking for a better way to move packages from one drive to another on a distribution point. Most threads about moving packages refer to this article:
While that works I'm looking for something cleaner that doesn't leave you with 2 shares. I think I'm nearly there. Here's what I'm doing so far:
1) Move <PackageID>.PCK from D:\SMSPKG to S:\SMSPKG
2) Move D:\SMSPKGD$\<PackageID> to S:\SMSPKGS$\<PackageID>
3) Update the SCCM database to point to the new location with the following code:
UPDATE PkgStatus SET Location = ( SELECT SUBSTRING(Location,1,43) + 'S' + SUBSTRING(Location,45,11) FROM PkgStatus WHERE Sitecode = '<SC>' AND Type = 2 AND Location LIKE '%SMSPKGD$%' AND ID = '<PackageID>' ) WHERE Sitecode = '<SC>' AND Type = 2 AND Location LIKE '%SMSPKGD$%' AND ID = '<PackageID>' UPDATE PkgStatus SET Location = ( SELECT SUBSTRING(Location,1,14) + 'S' + SUBSTRING(Location,16,21) FROM PkgStatus WHERE Sitecode = '<SC>' AND Type = 1 AND Location LIKE '%\D$\SMSPKG\%' AND ID = '<PackageID>' ) WHERE Sitecode = '<SC>' AND Type = 1 AND Location LIKE '%\D$\SMSPKG\%' AND ID = '<PackageID>' UPDATE PkgStatus SET HTTPUrl = ( SELECT SUBSTRING(HTTPUrl,1,32) + 'S' + SUBSTRING(HTTPUrl,34,11) FROM PkgStatus WHERE Sitecode = '<SC>' AND Type = 2 AND HTTPUrl LIKE '%SMSPKGD$%' AND ID = '<PackageID>' ) WHERE Sitecode = '<SC>' AND Type = 2 AND HTTPUrl LIKE '%SMSPKGD$%' AND ID = '<PackageID>'
4) Restart SMS_EXECUTIVE on relevent Secondary Site Server
5) Watch distmgr.log and verify that the HTTPUrl for the package shows new location:
Setting HTTPUrl to \SMSPKGS$">\\<Server>\SMSPKGS$
Unfortunately that last step still shows the old location. My initial thought is that the DP is not checking the Primary SCCM Database to get the location, but instead is referencing some value stored in WMI from when the package was last refresh. If I do a refresh on this DP from the console it can't find the new location of the PCK and starts pushing out a new copy and then everything's good, but the point of this isn't to just push the package down again. Does anyone know if the distribution manager is getting the local location of the package from WMI (Possibly root\ccm\LocationServices or something similar)? If so, it likely wouldn't be much work to add a function to a script to change the location stored in WMI. My final goal is to have a powershell script that you give a source and destination drive and it does everything from moving the content to the new location, update the SCCM database, and then whatever else i'm missing (possibly wmi) so that packages can be easily be moved from one spot to another cleanly as if they were always there.
u786farooq posted something along these lines that updating the DB was all you needed, but that doesn't seem to be the case