A user is asking for help writing a trigger in CU VDI that alerts users to clean up their D drive. Another user suggests using PowerShell with BurntToast to create toast notifications, but notes that it must be run in the user’s session. They provide several methods for doing so, including running in each user’s session and creating a scheduled task. Another user suggests writing a script that runs on the monitor instead of the target machine and uses Invoke-CUQuery and Invoke-CUAction to get information and run the toast notification script on the user’s session. They note that there are some nuances that need to be figured out and suggest using Get-CUAvailableActions to get the action ID of the toast script. A working example is requested.
Read the entire ‘How to Create Toast Notifications in CU VDI using PowerShell and ControlUp’ thread below:
I’m trying to write a trigger in CU VDI that alerts the user with a toast to clean up their D drive when their D drive disk space drops to
Anyone know a way to pull this off?
before joining Controlup a had a member of me team do something similar and he had use task scheduler. I put the details into chat GTP and if i remeber it is along the lines of what he did .
- Use PowerShell with BurntToast (per-user session)
is a PowerShell module for creating toast notifications.
Example script to show a toast:
“`
Import-Module BurntToast
New-BurntToastNotification -Text "Hello!", "This is a test notification."“`
⚠️ Must run in the user’s session.
If you run this from SYSTEM or via a scheduled task without session context, the user won’t see it.
- Run in each user’s session using psexec or Invoke-Command
You can inject into a user session with Sysinternals PsExec:
“`
psexec.exe -i powershell.exe -ExecutionPolicy Bypass -Command "Import-Module BurntToast; New-BurntToastNotification -Text ‘Server Notice’, ‘Updates will be applied at 6 PM’"“`
• -i <SessionID> tells PsExec to run interactively in that user’s session.
• Find session IDs with:
“`
quser“`
- Scheduled Task (best for multi-session servers)
Create a scheduled task that runs in the user context and triggers immediately. This guarantees the notification runs inside their session:
“`
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" -Argument "Import-Module BurntToast; New-BurntToastNotification -Text ‘Reminder’,’System maintenance tonight at 10 PM’"
$Trigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -Action $Action -Trigger $Trigger -TaskName "ShowToast" -User "DOMAIN\username" -RunLevel Limited -Force
Start-ScheduledTask -TaskName "ShowToast"“`
Then you can delete it if you only need it once.
- For all active sessions (looping)
To broadcast to all logged-on users:
“`
$queryResults = quser | Select-String "Active"
foreach ($result in $queryResults) {
$sessionId = ($result -split ‘\s+’)[2]
psexec -i $sessionId powershell.exe -Command "Import-Module BurntToast; New-BurntToastNotification -Text ‘Notice’, ‘Server reboot at 6 PM’"
}“`
✅ Key point: Toasts require the user’s context (explorer.exe running). SYSTEM or admin-only execution won’t display to the user. That’s why PsExec -i or scheduled tasks per-user are the usual solutions.
we used to do session recording in a session and push a notification to the user to warm them and also some survey stuff (before the time and CU sentiment)
just have my phone so bear with me.
- write a script that uses the execution context in the console set to “console/monitor” instead of target machine.
- This will cause the trigger to run the script on the monitor that is assigned to the machine that owns the disk.
- on the arguments tab, ensure that the machine name is passed along as argument 0 using a record property argument.
- Use invoke-cuquery -table Sessions -where “sServerName = ‘$($args[0])’”
- Take the objectguid or key from step 4 and pass it to:
- Invoke-cuaction -actionId IDOfYourToastScript -RecordsGuids KeysOrObjectGuidsFromStep4
- Maybe pass some arguments if needed.
Basically:
• run a script on the monitor instead
• Script asks the in memory database for all user sessions running on the machine which actually has the disk filling up
• Script then asks the monitor to run a different action (script) against the actual user sessions using invoke-cuaction
There’s a few nuances you’ll need to wait until I get to a computer. Or try and figure out.
• using get-cuavailableactions to get the action ID of the toast script
• The filter for actual user accounts (step 4 as currently written will include the console and service session that every modern system has)
• Some other details like other required cmdlet parameters.
But the above concept will work.
Good stuff @member !
If you can share a working example it would be great
Continue reading and comment on the thread ‘How to Create Toast Notifications in CU VDI using PowerShell and ControlUp’. Not a member? Join Here!
Categories: All Archives, ControlUp Scripts & Triggers
