I have just confirmed that, when my service is running the cmd.exe process, the RestartManager requests the restart, while otherwise, it does not.
My service would immediately kill the cmd.exe process the moment the service is asked to stop, but for whatever reason, I'm guessing the RestartManager seems to think that the cmd.exe process is a "critical application" and it doesn't realise that it's entirely under the control of my service, which will stop it when requested. Does this sound plausible, given what you know about the RestartManager? Do you know why it would just assume that cmd.exe won't be stopped by the uninstaller (maybe because it wasn't installed by our installer)? Alain -----Original Message----- From: Alain Forget [mailto:afor...@cmu.edu] Sent: June 27, 2013 14:12 To: 'General discussion for Windows Installer XML toolset.' Subject: RE: [WiX-users] Uninstall restart issue Sorry for the delay. I'm not sure I want non-elevated privileges to be able to stop my service, but I suppose that might be a last-ditch solution. Also, I thought for that CAs had to be marked as deferred (rather than immediate) for them to be quietly/silently executed in the background...is that not so? See this for more information: Below is what the Event Viewer\Windows Logs\Application -> Source: Restart Manager says. What I find most interesting is the fourth entry, where the description is "Machine restart is required.", and it points out the following applications: <RmRestartEvent xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/2005/08/Windows/Reliability/RestartManager/"> <RmSessionId>0</RmSessionId> <nApplications>5</nApplications> <Applications> <Application>cmd.exe</Application> <Application>My Client </Application> <Application>My Sensor 1</Application> <Application>My Sensor 2</Application> <Application>My Sensor 3</Application> </Applications> <RebootReasons>3</RebootReasons> </RmRestartEvent> I don't know what a "RebootReasons" of 3 is, but it's clearly identified my programs (but not the fact that they're actually services), as well as cmd.exe, which is something one of my sensors has executed. I will do further tests to see if it's actually what the cmd.exe is doing that's triggering the request to reboot, but let me know if you have any other thoughts. Event Viewer Log follows: Log Name: Application Source: Microsoft-Windows-RestartManager Date: 2013-06-27 13:50:05 Event ID: 10000 Task Category: None Level: Information Keywords: User: aforget Computer: aforget Description: Starting session 0 - ?2013?-?06?-?27T17:50:05.048184800Z. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-RestartManager" Guid="{SOMEGUID}" /> <EventID>10000</EventID> <Version>0</Version> <Level>4</Level> <Task>0</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2013-06-27T17:50:05.048184800Z" /> <EventRecordID>9756</EventRecordID> <Correlation /> <Execution ProcessID="3048" ThreadID="4828" /> <Channel>Application</Channel> <Computer>aforget</Computer> <Security UserID="SOMEID" /> </System> <UserData> <RmSessionEvent xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/2005/08/Windows/Reliability/RestartManager/"> <RmSessionId>0</RmSessionId> <UTCStartTime>2013-06-27T17:50:05.048184800Z</UTCStartTime> </RmSessionEvent> </UserData> </Event> Log Name: Application Source: Microsoft-Windows-RestartManager Date: 2013-06-27 13:50:15 Event ID: 10001 Task Category: None Level: Information Keywords: User: aforget Computer: aforget Description: Ending session 0 started ?2013?-?06?-?27T17:50:05.048184800Z. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-RestartManager" Guid="{SOMEGUID}" /> <EventID>10001</EventID> <Version>0</Version> <Level>4</Level> <Task>0</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2013-06-27T17:50:15.219402700Z" /> <EventRecordID>9758</EventRecordID> <Correlation /> <Execution ProcessID="3048" ThreadID="3352" /> <Channel>Application</Channel> <Computer>aforget</Computer> <Security UserID="SOMEID" /> </System> <UserData> <RmSessionEvent xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/2005/08/Windows/Reliability/RestartManager/"> <RmSessionId>0</RmSessionId> <UTCStartTime>2013-06-27T17:50:05.048184800Z</UTCStartTime> </RmSessionEvent> </UserData> </Event> Log Name: Application Source: Microsoft-Windows-RestartManager Date: 2013-06-27 13:50:24 Event ID: 10000 Task Category: None Level: Information Keywords: User: aforget Computer: aforget Description: Starting session 0 - ?2013?-?06?-?27T17:50:24.860219600Z. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-RestartManager" Guid="{SOMEGUID}" /> <EventID>10000</EventID> <Version>0</Version> <Level>4</Level> <Task>0</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2013-06-27T17:50:24.860219600Z" /> <EventRecordID>9762</EventRecordID> <Correlation /> <Execution ProcessID="3048" ThreadID="2524" /> <Channel>Application</Channel> <Computer>aforget</Computer> <Security UserID="SOMEID" /> </System> <UserData> <RmSessionEvent xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/2005/08/Windows/Reliability/RestartManager/"> <RmSessionId>0</RmSessionId> <UTCStartTime>2013-06-27T17:50:24.860219600Z</UTCStartTime> </RmSessionEvent> </UserData> </Event> Log Name: Application Source: Microsoft-Windows-RestartManager Date: 2013-06-27 13:50:25 Event ID: 10005 Task Category: None Level: Information Keywords: User: aforget Computer: aforget Description: Machine restart is required. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-RestartManager" Guid="{SOMEGUID}" /> <EventID>10005</EventID> <Version>0</Version> <Level>4</Level> <Task>0</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2013-06-27T17:50:25.000619800Z" /> <EventRecordID>9763</EventRecordID> <Correlation /> <Execution ProcessID="3048" ThreadID="2524" /> <Channel>Application</Channel> <Computer>aforget</Computer> <Security UserID="SOMEID" /> </System> <UserData> <RmRestartEvent xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/2005/08/Windows/Reliability/RestartManager/"> <RmSessionId>0</RmSessionId> <nApplications>5</nApplications> <Applications> <Application>cmd.exe</Application> <Application>My Client </Application> <Application>My Sensor 1</Application> <Application>My Sensor 2</Application> <Application>My Sensor 3</Application> </Applications> <RebootReasons>3</RebootReasons> </RmRestartEvent> </UserData> </Event> Log Name: Application Source: Microsoft-Windows-RestartManager Date: 2013-06-27 13:50:34 Event ID: 10001 Task Category: None Level: Information Keywords: User: aforget Computer: aforget Description: Ending session 0 started ?2013?-?06?-?27T17:50:24.860219600Z. Event Xml: <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Microsoft-Windows-RestartManager" Guid="{SOMEGUID}" /> <EventID>10001</EventID> <Version>0</Version> <Level>4</Level> <Task>0</Task> <Opcode>0</Opcode> <Keywords>0x8000000000000000</Keywords> <TimeCreated SystemTime="2013-06-27T17:50:34.743837800Z" /> <EventRecordID>9767</EventRecordID> <Correlation /> <Execution ProcessID="3048" ThreadID="3352" /> <Channel>Application</Channel> <Computer>aforget</Computer> <Security UserID="SOMEID" /> </System> <UserData> <RmSessionEvent xmlns:auto-ns2="http://schemas.microsoft.com/win/2004/08/events" xmlns="http://www.microsoft.com/2005/08/Windows/Reliability/RestartManager/"> <RmSessionId>0</RmSessionId> <UTCStartTime>2013-06-27T17:50:24.860219600Z</UTCStartTime> </RmSessionEvent> </UserData> </Event> -----Original Message----- From: Blair [mailto:os...@live.com] Sent: June 26, 2013 09:17 To: General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Uninstall restart issue It also requires that the service is setup to allow non-elevated privileges to stop it. Event Viewer\Windows Logs\Application Source: RestartManager -----Original Message----- From: Joel Budreau Sent: Tuesday, June 25, 2013 6:22 PM To: afor...@cmu.edu ; General discussion for Windows Installer XML toolset. Subject: Re: [WiX-users] Uninstall restart issue Hey Alain, Take a look at my answer to this problem on stackoverflow - http://stackoverflow.com/questions/6913332/wix-installer-problem-why-does-restartmanager-mark-service-as-rmcritical-and-no/8147540#8147540 Basically, you can 'lie' about the custom action and mark it as immediate instead of deferred. The drawback is that if your install fails and rollsback, the service you've shut down will still be shut down. Up to you whether or not that's an appropriate risk for your product. - Joel On Sat, Jun 15, 2013 at 11:11 AM, Alain Forget <afor...@cmu.edu> wrote: > I'm still wrestling with this request to restart on uninstall. To > recap, I have an MSI that when I install it, and then try to uninstall > it, it usually tells the user that some of the files to be uninstalled > are in use and will require a reboot. However, this should not be, > because the services that are using the files will stop immediately upon > request. > > The problem seems to be that the installer is making the determination > that the files are in use before even trying to stop services. Looking > at the uninstall log, during FileCost, the installer determines that > multiple "folder had been blocked by the 1 mask argument (the folder > pair's iSwapAttrib member = 0)", which I think means it's in use? > Furthermore, at InstallValidate, "RESTART MANAGER: Did detect that a > critical application holds file[s] in use, so a reboot will be > necessary." Note that both InstallValidate and FileCost come before > StopServices (see http://msdn.microsoft.com/en-us/library/aa372038). > > It had been suggested that I should stop the services myself with "net > stop". So I attempted to do so with this in my .wxs: > > <!-- Silently stop my services (with elevated privileges; > Execute="deferred", see > http://wix.sourceforge.net/manual-wix3/qtexec.htm ) --> <CustomAction > Id="Set_cmdStopMyService" > Property="cmdStopClientCommModuleService" Value="net stop > [#myService]" /> <CustomAction Id="cmdStopMyService" Execute="deferred" > BinaryKey="WixCA" > DllEntry="CAQuietExec" Return="check" Impersonate="no" /> > > <InstallExecuteSequence> > <Custom Action="Set_cmdStopMyService" Before="CostInitialize" > ></Custom> > <Custom Action="cmdStopMyService" Before="CostInitialize" > ></Custom> > </InstallExecuteSequence> > > However, candle / light don't allow it: > > error LGHT0204 : ICE77: cmdStopMyService is a in-script custom action. > It must be sequenced in between the InstallInitialize action and the > InstallFinalize action in the InstallExecuteSequence table > > Following Light's recommendation wouldn't solve my problem, because > InstallInitialze happens long after the uninstaller has decided that > the files are in use. > > So I'm completely stumped and would appreciate some suggestions. > > Alain > > > > ---------------------------------------------------------------------- > -------- This SF.net email is sponsored by Windows: > > Build for Windows Store. > > http://p.sf.net/sfu/windows-dev2dev > _______________________________________________ > WiX-users mailing list > WiX-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users