----- Original Message ----- > From: Phil Wilson <phildgwil...@gmail.com> > To: General discussion about the WiX toolset. > <wix-users@lists.sourceforge.net> > Cc: > Sent: Friday, December 12, 2014 11:30 AM > Subject: Re: [WiX-users] Windows Updates - either pending or running causes > our installs to fail > >T here is a Windows Update Agent API. The IUpdateInstaller interface > has an IsBusy property that seems to indicate that an update is in > progress. This fragment of C++ may be a start. It seems to work in the > sense that it tells me not busy :) but is otherwise untested.
Cool - that did work. Cleaned up a little, and added support for pending. Tested on a system with an update that required rebooting and saw the busy during the update and reboot required after the install was done. I compiled this with VS2013 in a cmd window with just "cl filename.cpp" Dave ======== #include <windows.h> #include <wuapi.h> #include <iostream> #pragma comment(lib, "ole32.lib") int main() { if (!SUCCEEDED(CoInitialize(NULL))) return 1; IUpdateInstaller* iInstaller = NULL; if (!SUCCEEDED(CoCreateInstance(CLSID_UpdateInstaller, NULL, CLSCTX_INPROC_SERVER, IID_IUpdateInstaller, (LPVOID*)&iInstaller))) return 1; VARIANT_BOOL bVal; if (SUCCEEDED(iInstaller->get_IsBusy(&bVal))) { if (bVal) std::cout << "get_IsBusy: bVal!\n"; else std::cout << "get_IsBusy: Not so much\n"; } else std::cout << "get_IsBusy: Um, don't know\n"; if (SUCCEEDED(iInstaller->get_RebootRequiredBeforeInstallation(&bVal))) { if (bVal) std::cout << "get_RebootRequiredBeforeInstallation: bVal!\n"; else std::cout << "get_RebootRequiredBeforeInstallation: Not so much\n"; } else std::cout << "get_RebootRequiredBeforeInstallation: Um, don't know\n"; iInstaller->Release(); return 0; } ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users