Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any API function for shutting down Windows while installing any pending updates?

I know the ExitWindowsEx() API function which simply shuts down Windows. But as far as I know, you cannot make Windows install any pending updates with it.

Is there any API support for installing any pending updates (in that standard blue screen which says "n of m updates have installed - Please don't turn off or unplug your PC, Windows will shut down itself") then shutting down Windows (equivalent to clicking the "Install updates and shutdown" menu option of the Windows user interface)?

(OS Version: Windows XP and higher.)

like image 843
hkBattousai Avatar asked Jan 24 '13 16:01

hkBattousai


1 Answers

The best you can do is call InitiateShutdown and include the SHUTDOWN_INSTALL_UPDATES flag on Vista and higher. Windows XP does not support programmatically shutting down with updates.

like image 171
Raymond Chen Avatar answered Oct 12 '22 14:10

Raymond Chen