You may have noticed that if you right click on the distribution point node of a Package you will get an option to Update Distribution points. If you open the node and right click on an individual DP you will get an option to refresh the package on that distribution point. There is no option to refresh a package on all DP's and there is no option to Update a package on just one DP. What's going on here? Well, each function is slightly different. When you create a package and assign a source location to it, that package is actually stored on the site server in the SMSPKG folder as a compressed file in the form of PackageID.pck extension. This folder is shared out from the site server as \\server\SMS_CPSx$, where x represents the drive letter it is located on. When choosing the option to Update a package a delta file of the changes is created from the specified source location and the version number is incremented for both the source and client policy. The delta file is what gets sent out to the DP's. Choosing the option to refresh a package will actually repair a package at a DP by recopying the entire compressed package from the local site server to the DP. There is no update of any changes that may have occured at the package source.
More info: http://technet.microsoft.com/en-us/library/bb892806.aspx
and here: http://www.serverwatch.com/tutorials/article.php/1474011
Showing posts with label Refresh Package. Show all posts
Showing posts with label Refresh Package. Show all posts
Wednesday, October 8, 2008
Tuesday, September 16, 2008
Scripting SCCM to refresh a package source directory
My company has a need to have a particular package's distribution points update automatically when a file in the package source directory changes. We looked at the package's built in option to automatically update DP's on a schedule. Ultimately, we decided this would not work. We have a very short window to obtain a 4GB updated package source and then distribute that content to clients. If we set the window too small (every 20 minutes), then clients would be mostly locked out from getting content from the DP, since the DP would be constantly updating. If we set it too large, we don't get the content within the targeted time window. Using the SCCM SDK ( http://www.microsoft.com/downloads/details.aspx?FamilyId=064A995F-EF13-4200-81AD-E3AF6218EDCC&displaylang=en ) and information from a post by aparrott on myitforum: http://www.myitforum.com/forums/m_180582/mpage_1/key_/tm.htm#180582 we were able to create our own script that will detect the change and then update the DP. I have a scheduled task that runs every 20 minutes. If the last modified stamp on the text file is different, then the DP's will update. This happens once a day, but I get new content onto the DP's within 25 minutes. Now I just need to delete the old mandatory assignment and create a new one.
Careful of the wordwrap! I suggest you copy and paste into notepad.
'==========================================================================
'
' VBScript Source File -- Created with PrimalScript.
'
' NAME: SCCM_Refresh_DP_Nightly_Build.vbs
'
' Created by: Bill Phillips, ESRI
' Date: 09/15/2008
'
' COMMENT:
' Run this as a scheduled task under the System account.
' Machine's account must have rights to the shares.
' Example code from: http://www.myitforum.com/forums/m_180582/mpage_1/key_/tm.htm#180582
'==========================================================================
On Error Resume Next
' --- Set Variables
siteName = "tst"
serverName = "SMSSERVER"
SMS_PackageID = "tst00158"
' --- Create Objects
Set loc = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices = loc.ConnectServer(servername , "root\SMS\site_" & siteName)
set FSO=CreateObject("Scripting.FileSystemObject")
CompareFiles()
' --- Compare Files
Function CompareFiles()
Set objSourceBuildNumTextDate = FSO.GetFile ("\\smsserver\source\foo.txt")
Set objDestBuildNumTextDate = FSO.GetFile ("\\dpserver\SMSPKGE$\tst00158\foo.txt")
If not objSourceBuildNumTextDate.DateLastModified = objDestBuildNumTextDate.DateLastModified Then RefreshPKG
End Function
' --- Refresh Package
Function RefreshPKG()
Set packages = WbemServices.ExecQuery("Select * From SMS_Package where PackageID = '" & SMS_PackageID & "'")
For Each package In packages
Package.RefreshPkgSource( )
Next
End Function
Labels:
Refresh Package,
SCCM,
Scripting
Subscribe to:
Comments (Atom)