Payton Flint's Tech Blog
Menu
  • Home
  • Blog
  • Categories
  • Resources
  • About
  • Contact
Menu

Bypass Deferred Restart For Urgent Powershell Application Deployment via MECM

Posted on August 22, 2022June 4, 2023 by paytonflint

If a reboot is required for an application installation, you should likely attempt to force the device to reboot using the, “Should Configuration Manager enforce specific behavior regardless of the application’s intended behavior” drop-down menu in the Deployment Type settings.

Unfortunately, depending on client settings, you may experience a deferred restart.

If you are keen to bypass this and restart the device anyway, perhaps for an urgent overnight installation, it can be done from within a Powershell script, but in a not-so-obvious way. Please note that this should only be done with extreme caution and only if the circumstances allow/permit. If the client is deferring a restart, there is likely a reason. You can read more on device restart deferral and notifications here:

https://docs.microsoft.com/en-us/mem/configmgr/core/clients/deploy/device-restart-notifications

Using the Restart-Computer cmdlet is the obvious go-to, but it will not work as expected. It will restart the computer, however, you will receive an execution failure code. When the restart is executed from within the script, it will occur almost immediately. Because of this, the script will not exit satisfactorily, and will return an execution failure code (1073807364).

This can be observed in the CCM AppEnforce.log file as well.

The way to get around this is conveniently built into Windows: shutdown.exe. As an executable, it is “triggered” from within the script, but runs independently of it. This means our script can exit in healthy manner- all the while shutdown.exe is running in a parallel fashion. Shutdown.exe also has a built-in timer switch. Using the /t switch, you can specify the amount of delay in seconds.

So, for example, your script might look like:

               Start-Process -Wait -FilePath “Install.exe” -ArgumentList “-silent”

               Shutdown.exe /r /f /t 30

Admittedly, this is less-than-ideal, because your script could potentially fail for some unforeseen reason, and the device would still reboot. But, a bit of caution when implementing your detection logic in MECM will ensure you can detect success/failure regardless.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About The Author

Author's Portrait

In my journey as a technologist and 11 years of experience as an IT professional, I have found my niche as Director of Infrastructure Services; developing my skillsets in management, scripting, cloud infrastructure, identity management, and networking.

I have experience as a Systems Administrator and Engineer for large enterprises including the DoD, government agencies, and a nuclear-generation site.

I've been blessed to collaborate with engineers at esteemed Fortune 50 corporations, and one of Africa's largest, to ensure successful implementation of my work.

GitHub Button

Credentials

M365 Endpoint Administrator Associate
M365 Fundamentals
Microsoft AZ-900
CompTIA CSIS
CompTIA CIOS
CompTIA Security+
CompTIA Network+
CompTIA A+
  • April 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
© 2022 Payton Flint | The views and opinions expressed on this website belong solely to the author/owner and do not represent the perspectives of any individuals, institutions, or organizations, whether affiliated personally or professionally, unless explicitly stated otherwise. The content and products on this website are provided as-is with no warranties or guaranties, are for informational/demonstrative purposes only, do not constitute professional advice, and are not to be used maliciously. The author/owner is not responsible for any consequences arising from actions taken based on information provided on this website, nor from the use/misuse of products from this site. All trademarks are the property of their respective owners.