Click to Rate and Give Feedback
TechNet
TechNet Library
Systems Management
System Center
Appendices
Packages
 Sending Packages to Distribution Po...

  Switch on low bandwidth view
Sending Packages to Distribution Points

Packages with source files are useful only when they are sent to distribution points. For packages to be sent to distribution points, you must specify the distribution points to which you want the packages sent. You do this by creating objects of the SMS_DistributionPoint class.

Instances of the SMS_DistributionPoint class require a Network Abstraction Layer (NAL) path, a package ID, and the site code of the site at which the distribution points are located. You should also specify the site name. You can get the site code and NAL path by listing the available distribution points. You do this by querying the SMS_SystemResourceList class. You can get the site name from the site details of the SMS_Site class.

Sample C.21 makes a package available on all distribution points in your SMS hierarchy.

Sample C.21 AssignDistributionPoints - assigns all available distribution points to a package

if WScript.Arguments.Count<>1 then
       WScript.Echo "One argument please: the package ID"       
       WScript.Quit
else
       PackageID = WScript.Arguments(0)
end if
Set loc = CreateObject("WbemScripting.SWbemLocator")
Dim WbemServices
Set WbemServices = loc.ConnectServer( , "root\SMS\site_B2K")
Set AllDPs = wbemServices.ExecQuery("Select * From SMS_SystemResourceList WHERE RoleName='SMS Distribution Point'")
For Each DP In AllDPs
    Set Site = WbemServices.Get("SMS_Site='" & DP.SiteCode  & "'")
    Set newDP = WbemServices.Get("SMS_DistributionPoint").SpawnInstance_()
    newDP.ServerNALPath = DP.NALPath
    newDP.PackageID = PackageID
    newDP.SiteCode = DP.SiteCode
    newDP.SiteName = Site.SiteName
    newDP.Put_
Next

If you want to control when your package is first distributed to the distribution points (beyond the control that SMS addresses provides), you can run the script in Sample C.21 at that time. Do not assign distribution points to the package prior to that time. Run the script as a scheduled task with a suitably privileged account, if an administrator is not available at that time.

If you want to refresh specific distribution points for a package (possibly because they have been rebuilt) and you want to use a script (because you have many such distribution points or the timing is inconvenient), you can use the RefreshNow property of the SMS_DistributionPoint class, as shown in Sample C.22. If you want to refresh all the distribution points that are assigned to a package, you can use the RefreshPkgSource instance method of the SMS_Package class.

Sample C.22 RefreshDPs.vbs - part of a script that refreshes distribution points

Set DPs = wbemServices.ExecQuery("Select * From SMS_DistributionPoint WHERE SiteCode='" & sitecode & "' AND PackageID='" & PackageID & "'")
For Each DP In DPs
   DP.RefreshNow = True
   DP.Put_
Next

The final detail that needs to be specified when creating packages is access accounts. By default, administrators get full control, and guests and users get read access to every package, even when the package is created by using a script. Access accounts can be controlled from your script by using the SMS_PackageAccessByUsers class.

For More Information

Did you find this information useful? Please send your suggestions and comments about the documentation to smsdocs@microsoft.com.

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker