15

Sending User Notifications with RESONE Workspace

posted on
Sending User Notifications with RESONE Workspace

For me, when designing user workspaces, user experience is key. In my opinion the system should notify a user when something with the user workspace is wrong. For example, when a RESONE Workspace UserSetting location or Home folder is not available, the system should notify the user that it is not available and should ask to contact the system administrator. This can be done with a simple message box, but when using Microsoft Windows 10 it is much cooler to use a notification from the Action Center.

To detect if something is wrong, I use a two-step process. First I use the Location & Devices feature from RESONE Workspace. When detecting if the user has a home directory, I create a Zone called NO-HOMEDRIVE with a rule based on Configuration – Files and Folders – File or Folder Exists – Drive H: Does NOT exists.

Second step is to create a Execute Command based on the just created zone. The Execute Command will use a PowerShell script to send the notification.

This is my PowerShell script:

[xml]$toast = @"

(toast duration="long" )(visual)(binding template="ToastGeneric")(image id="1" placement="appLogoOverride" src="" /)(text id="1")(/text)(text id="2")(/text)(text id="3")(/text)(/binding)(/visual)
(audio src="ms-winsoundevent:Notification.Reminder"/)(/toast)

#Please replace above brackets with xml brackets. I am sorry, editor cannot show xml :-(

"@

Start-Sleep -s 60 # wait 60 seconds to prevent timing issue

$app = "MarcelVenema.com"
$image = "C:\Temp\MV.PNG"
$caption = "Warning"
$text1 = "Your personal folder (H:) cannot be accessed. (code: P32) Please contact your system administrator."
#$text2 = ""

$element = $toast.GetElementsByTagName('image'); $element[0].src = "file:///$image"
$element = $toast.GetElementsByTagName('text')[0].innerXML = $caption;
$element = $toast.GetElementsByTagName('text')[1].innerXML = $text1;
$element = $toast.GetElementsByTagName('text')[2].innerXML = $text2;

[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
$notify = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app)
$notification = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument
$notification.LoadXml($toast.OuterXml)
$notify.Show($notification)

 

WindowsNotifications...   WindowsNotifications...  

 

Generally speaking, I use notifications for the following events:

  • No Home drive
  • No RESONE Workspace User Settings folder
  • Inform users using Development/Test environment.
  • Inform users using Management workstation.
  • Wrong workstation deployment / OU placement.
  • etc.

A RESONE Workspace BuildingBlock is also provided for your convenience, see Attachments download below.

UPDATE January 13, 2017: I added a Start-Sleep command at the beginning of the script to wait for 60 seconds. Dennis van Dam mailed me the script wasn't working. It turned out, when starting a new session, the toast notification class is not ready at logon. Just wait 60 seconds, or maybe longer, and then display the message. Another solution is not to use the RESONE Workspace Execute Command and create a hidden autolaunched application.

 

| Categories: RESONE Workspace, PowerShell | Tags: | Comments: (0) | View Count: (1180) | Return

Attachments

  1. execute_command_NotifyIfHomeFolderDoesNotExist.zip 10/12/2016 8:48:24 PM

Post a Comment

Blogs I read:

AndrewMorgan.ie

From the creator of ThinKiosk...

BarrySchiffer.com

Former co-worker.

E2Evc.com

Former PubForum, famous by Alex Juschin's dynamic agenda...

IngmarVerheij.com

Blog of Ingmar Verheij, DUCUG member.

ITStore-guru.com

RES ONE products related blog of Chris Jeucken.

JeffWouters.nl

PowerShell guru...

BasvanKaam.com

Former co-worker, great Citrix info...

MyVirtualVision.com

Kees Baggerman's blog.

RemkoWeijnen.nl

Virtualization, hacking, debugging and more.

ResGuru.com

Max Ranzau technical blog dedicated to RES Software...

VanBragt.net

Daily news from Wilco van Bragt.

Workspace-Guru.com

Blog from Chris Twiest about RES ONE Workspace.