Notification balloons seem to be a frequent topic of feedback from customers. There may pop up too often, or only certain users should get them, or the timing isn’t configurable enough.
Lately we’ve had multiple customers asking for a very specific feature. The AdminUI for SCCM provides the ability to disable notification balloons for normal Software Distribution packages, but not for Task Sequences.
While there are currently no plans to modify the AdminUI to add this ability, all of the necessary logic is already present in the client code; you just have to go out of your way to enable it. If the ability to disable notification balloons for Task Sequences is something that would be beneficial in your environment then you can use the script below to automate the process.
The example below needs to be run on a site server by a user who has sufficient permissions in SCCM to modify the Task Sequences in question. Running the example with no command line arguments will provide usage instructions.
There is no guarantee or warranty associated with this example. Make sure you test any utility before using it in a production environment; and, as always, make sure that you are running frequent backups and that you test the restoration procedure on a regular basis to ensure that the backups are valid.
The script text is below but you can also download it directly here.
Option Explicit On
If WScript.Arguments.Count < 1 Then WScript.Echo "Usage:" WScript.Echo " DisableTSNotification.vbs -all" WScript.Echo " DisableTSNotification.vbs PackageID [PackageID]..." WScript.Quit End If
Dim strComputer Dim siteCode Dim objWMIService Dim colItems Dim objItem Dim packageID Dim itemFound Dim numPackages Dim numUpdated
strComputer = "." siteCode=GetSiteCode() Set objWMIService = GetObject("winmgmts://" & strComputer & "/root/sms/site_" & siteCode)
If StrComp(UCase(WScript.Arguments.Item(0)), "-ALL", 1) = 0 Then numPackages = 0 numUpdated = 0 Set colItems = objWMIService.ExecQuery("SELECT * FROM SMS_TaskSequencePackage", "WQL", 32) For Each objItem in colItems If (objItem.ProgramFlags AND 1024) = 0 Then objItem.ProgramFlags = objItem.ProgramFlags OR 1024 objItem.Put_ numUpdated = numUpdated + 1 WScript.Echo "Modified package " & objItem.PackageID End If numPackages = numPackages + 1 Next WScript.Echo "Updated " & numUpdated & " of " & numPackages & " packages" Else For Each packageID in WScript.Arguments Set colItems = objWMIService.ExecQuery("SELECT * FROM SMS_TaskSequencePackage WHERE PackageID='" & packageID & "'", "WQL", 32) itemFound = false For Each objItem in colItems If (objItem.ProgramFlags AND 1024) = 0 Then objItem.ProgramFlags = objItem.ProgramFlags OR 1024 objItem.Put_ WScript.Echo "Modified package " & objItem.PackageID Else WScript.Echo "No need to update package " & objItem.PackageID End If itemFound = true Next If itemFound = false Then WScript.Echo "ERROR: Package " & packageID & " was not found on this server" End If Next End If
Function GetSiteCode() Dim objSWbemLocator Dim objSWbemServices Dim ProviderLocation Dim Location Dim strSiteCode
objSWbemLocator = CreateObject("WbemScripting.SWbemLocator") objSWbemServices = objSWbemLocator.ConnectServer(".", "root\sms") ProviderLocation = objSWbemServices.InstancesOf("SMS_ProviderLocation")
For Each Location In ProviderLocation If Location.ProviderForLocalSite = True Then strSiteCode = Location.SiteCode End If Next
GetSiteCode = strSiteCode End Function
Trevor Duke | Escalation Engineer
Good article, Trevor!
Before running this script, is there a way to undo it to allow task sequence notifications to appear in the future?
I also want to know if there is a chance to undo it?