次の方法で共有


Using PowerShell for User Notification in SCCM 2012

 

There are many benefits to moving away from .hta or command prompt based End User pop up notifications in Configuration Manager application deployments. Forcing an open command prompt window open and not hidden, on an end user’s screen has always been non-optimal, fraught with permissions issues and very 1990’s. Using a .hta file allowed for some really nice looking end user notifications, but .hta was limited to the display elements that were acceptable to a web page.

 

I’ve been trying to move most of the command based scripts/tasks that I’ve used over the years to PowerShell, and moving Configuration Manager Application End User notifications to PowerShell just seemed like a good idea.

 

PowerShell has full access to the .NET framework, and as such you can move all of your SCCM End User Notifications into a PowerShell script and put them in the Notification Area (just like all the other Notifications the operating system already displays).

 

Here’s an example:

 

I want to create a package to remove Office 2013 and install Office 2016, and I want to put a notification in the Notification Area for my end users.

 

The creation of the Office 2016 package is easy. You can find details on how to do that here Deploy Office 2016 with SCCM 2012.

But remember, I want to customize the Notification and put it in the Notification Area with the rest of the OS notifications, and I want to specify the time each notification is displayed.

 

Using Windows PowerShell ISE I create the following:

 

snip_20160104134616

 

 

So what does all this do?

The [void] statement just prevents commands that load the System.Forms.Windows class from being displayed.

I then point to a folder where I keep custom icons for the icon I want displayed in the Notification.

I add the Balloon Tip text and title.

 

PowerShellNotificationArea_01

PowerShellNotificationArea_02

 

Then I specify how long I want the Balloon tip to display in milliseconds. Less is more in my experience,

but your mileage may vary (as your end users probably vary as well).

 

PowerShellNotificationArea_03

PowerShellNotificationArea_04

 

And then here’s what I end up with.

snip_20160104135548

 

and then

 

snip_20160104135632

 

I can now either add this to a Task Sequence in ConfigMgr that installs Office 2016 or I can make it a requirement to an existing Office 2016 deployment package.

 

 

Here’s a link to the completed PowerShell script EndUserPowerShellNotification