'This script adds a SCCM package to all standard distribution const EVENTLOG_INFORMATION = 4 Dim strDPcount 'Change to 1 if you want the script to create an event-log entry each time a package is created. sEventlog = "1" set objShell = CreateObject("WScript.Shell") 'collects command line arguments for the script passed down by the status filter rule Set args = WScript.Arguments PackageID = args.Item(7) strPackageID = Mid(PackageID,2,8) 'Connect to provider namespace for local computer. Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") Set objSWbemServices= objSWbemLocator.ConnectServer(".", "root\sms") Set ProviderLoc = objSWbemServices.InstancesOf("SMS_ProviderLocation") For Each Location In ProviderLoc If Location.ProviderForLocalSite = True Then Set objSWbemServices = objSWbemLocator.ConnectServer _ (Location.Machine, "root\sms\site_" + Location.SiteCode) Set Site = objSWbemServices.Get("SMS_Site='" & Location.SiteCode & "'") End If Next CheckSource Sub CheckSource ' Checks if the package contains sourcefiles and that the packagetype = Software Distribution Package ( value 0) Set colItems = objSWbemServices.ExecQuery("Select PkgSourceFlag from SMS_Package where PackageID = '" & strPackageID & "' and PackageType = '0'") For Each objItem in colItems if objitem.pkgsourceflag = "2" then SetDP end if Next End Sub Sub SetDp 'Adds the package to all standard distribution points Set AllDPs = objSWbemServices.ExecQuery("Select * From SMS_SystemResourceList WHERE RoleName='SMS Distribution Point' and Nalpath not like '%PXE%' ") strDPcount = "0" For Each DP In AllDPs Set newDP = objSWbemServices.Get("SMS_DistributionPoint").SpawnInstance_() newDP.ServerNALPath = DP.NALPath newDP.PackageID = strPackageID newDP.SiteCode = Site.SiteCode newDP.SiteName = Site.SiteName newDP.Put_ strDPcount = strDPcount + 1 Next End Sub 'Write to eventlog if Seventlog = 1 If Seventlog = "1" and strDPcount > "0" then strMessage = "Added Package: " & strpackageID & " to " & strDPCount & " Distribution Points" objShell.LogEvent EVENTLOG_INFORMATION, strMessage End IF