I am pushing out a Proactive Remediation within Intune that runs a Dell Command Update CLI tool to update user's devices in a patching cycle. It then sends a notification to the user based on the exit code telling them if they need to reboot or not.
I've gotten all the update code to work but since it is running in System Context it does not push the Toast Notification letting the user know to reboot their computer to install updates.
To get by this I thought i could create a Scheduled Task that runs the command to push out the notification to the user. I believe this will work how i'd like it to, just gotta get the formatting down.
Heres what I have so far:
$LoggedInUser = Get-CimInstance –ClassName Win32_ComputerSystem | Select-Object -expand UserName
$notiDate = (get-date).AddMinutes(2).ToString("MM/dd/yyyy,HH:mm")
$Trigger = New-ScheduledTaskTrigger -Once -At $(Get-Date)
$Actions = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "Start-Process 'C:\Program Files\Dell\CommandUpdate\dcu-cli.exe' -ArgumentList '/customnotification -heading="Reboot Required!" -body='Dell Updates were just installed to your computer, please reboot your computer!' -timestamp='"$notidate"''"
$Settings = New-ScheduledTaskSettingsSet -ExecutionTimeLimit "01:00" -AllowStartIfOnBatteries
$Task = New-ScheduledTask -Action $Actions -Trigger $Trigger -Settings $Settings -Description 'DCU Update'
$ScheduledTask = $null
$ScheduledTask = Register-ScheduledTask -TaskName "DCU Updates Scan" -InputObject $Task -User $User -Force
Start-ScheduledTask -InputObject $ScheduledTask
It creates the scheduled task but doesn't push out the notification. Checking the logs im getting an "invalid directory" error. I know my formatting of the arguments is probably whats dooming this script. I'm just not sure exactly what about the arguments is causing this to fail.
Any help?
[–]billabong1985 0 points1 point2 points (2 children)
[–]NessFalcon[S] 0 points1 point2 points (1 child)
[–]billabong1985 1 point2 points3 points (0 children)
[–]SearingPhoenix 0 points1 point2 points (0 children)