From 6dede51bf7aaf58bd0fa961f95aaa027a53d6413 Mon Sep 17 00:00:00 2001 From: adipiciu <13155063+adipiciu@users.noreply.github.com> Date: Wed, 20 Jul 2022 22:19:37 +0300 Subject: [PATCH] Update RunToastHidden.cmd If you are running the script on 64bit OS from 32bit context, like a SCCM program, the script will not see the 64bit registries. Fix to open PowerShell in 64bit context, when running from 32bit context like SCCM programs. --- RunToastHidden.cmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RunToastHidden.cmd b/RunToastHidden.cmd index 4d35871..ed1a7d7 100644 --- a/RunToastHidden.cmd +++ b/RunToastHidden.cmd @@ -1,2 +1,8 @@ REM This file is intended to be used when the toast notification script is used with scheduled tasks with the Hidden.vbs file. See the documentation for further details -powershell.exe -file "C:\ProgramData\ToastNotificationScript\PendingReboot\New-ToastNotification.ps1" -Config "\\YourNetworkPath\ToastNotificationScript\Configs\config-toast-pendingreboot.xml" \ No newline at end of file + +IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( +SET pspath="C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe" +) ELSE ( +SET pspath="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" +) +%pspath% -file "C:\ProgramData\ToastNotificationScript\PendingReboot\New-ToastNotification.ps1" -Config "\\YourNetworkPath\ToastNotificationScript\Configs\config-toast-pendingreboot.xml"