Turn off service automatically at shutdown

Discussion in 'other software & services' started by newbino, Jan 26, 2013.

Thread Status:
Not open for further replies.
  1. newbino

    newbino Registered Member

    Joined:
    Aug 13, 2007
    Posts:
    377
    My system hangs at shutdown due to the Fitbit Data Uploader service (I have identified it thanks to this procedure http://support.microsoft.com/kb/929135) so I have to remember to disable it every time, which is next to impossible even though I have created on my desktop a .bat file to do the task - I simply forget.

    Can any kind soul suggest a way to automatically disable the service at shutdown? Maybe it can be down with the Task Scheduler but I am not up to it.

    Thanks for your guidance

    PS tried Fitbit help team but it's worse than useless, it has been clueless in offering suggestions to solve the issue
     
  2. allizomeniz

    allizomeniz Registered Member

    Joined:
    Aug 23, 2009
    Posts:
    903
    Did you ever find a solution for this? I know you said you didn't want to mess with the Task Scheduler, but I think it would be the best way, and should be relatively easy to do.

    I think you'll have to use as a trigger an Event, in your case at shutdown. You can get all the information you need from the Event Viewer (C:\Windows\System32\eventvwr.msc). Shut down your computer then restart. Open the Event Viewer and look at Summary of Administrative Events>Information. Scroll down looking for events in the "Last Hour" column. The shutdown event should be fairly close to the top of the list. I'm using Vista, and for me it's event 4, Kernel-Processor-Power. When you think you've found the right one, shut down again making note of the time, then restart. Return to the Event Viewer. See if the number for the event in the "Last Hour" column has increased by one. If so, that should be it. Select it and then either right-click and select "View all instances of this event" or select "View all instances of this event" in the right-hand pane. Look at the first entry in the list and see if it matches the time you noted previously when you shut down. Then look at the bottom of the window. You'll see the information you need to set up Task Scheduler (Log Name, Source, and Event ID).

    From there it's easy to create a task in Task Scheduler. In the Trigger tab Use the event you just located in Event Viewer using the Log, Source and Event ID. For the Action tab use "Start a program" and browse to the location where you have the .bat stored. The rest is pretty self explanatory.

    If you want to make the process completely invisible you can use Bat to Exe converter:

    http://www.softpedia.com/get/System/File-Management/Batch-To-Exe-Converter.shtml

    Set it to "Invisible application" when you convert ("Compile" in Bat to Exe converter), then you won't get the command prompt window you usually get when you run .bats. Just point Task Scheduler to the .exe instead of the .bat.

    As I said, I'm using Vista so I'll give you the information for mine, but it may or may not be of any use if you have a different OS.

    Log: System
    Source: Kernel-Processor-Power
    Event ID: 4

    It may seem like a lot of trouble, but once you understand it, it takes very little time to automate actions. :)
     
    Last edited: Jan 29, 2013
  3. allizomeniz

    allizomeniz Registered Member

    Joined:
    Aug 23, 2009
    Posts:
    903
    Now that I think about it, this could be more complicated than I thought. I tried it a couple of times and the problem is by the time the shutdown event occurs it's too late. I also set it to run at log off but that didn't work either. It runs as soon as I log back on but that doesn't do you any good. Oh well, I tried, good luck. Someone else might know some magic that'll work.
     
  4. allizomeniz

    allizomeniz Registered Member

    Joined:
    Aug 23, 2009
    Posts:
    903
    Eureka, the event you need is:

    Log: System
    Source: USER32
    Event ID: 1074

    That's the ID for when you click the shutdown button. I checked XP and it's the same. I don't know about 7 or 8, but I think 7 at least should be the same as Vista.

    I tested it on Vista and it worked. If you can get it set up it should work for ya. :)
     
  5. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,696
    Set the service to manual perhaps?
    Mrk
     
  6. Pliskin

    Pliskin Registered Member

    Joined:
    Feb 8, 2009
    Posts:
    341
    For XP:

    Start-Run-gpedit.msc
    Computer Configuration-Windows Settings-Scripts-Shutdown

    Browse to the location of the BAT file, and select it.
     
  7. newbino

    newbino Registered Member

    Joined:
    Aug 13, 2007
    Posts:
    377
    @Mrkvonic I need the service on as from time to time during the day it uploads the Fitbit gadget data to the server

    @Pliskin Tried your solution (am running Win 7 x64) but system still hangs at shutdown. Apart from selecting the .bat file, do I need to add any parameters?

    @allizomeniz Thanks for your help, when I have a moment in the next couple of days I'll try your solution and return here

    Not to needlessly badmouth the Fitbit customer service, after some useless innterchanges they have finally escalated me to someone who has proceeded to ask for the logs - at least a step in the right direction
     
  8. Pliskin

    Pliskin Registered Member

    Joined:
    Feb 8, 2009
    Posts:
    341
    No, but maybe you should try to add add some delay in your batch file (to do its work):
     
  9. Notok

    Notok Registered Member

    Joined:
    May 28, 2004
    Posts:
    2,969
    Location:
    Portland, OR (USA)
    If you just create a batch file with "shutdown.exe /s /t xxx" (without quotes, and "xxx" being the number of seconds you want) and the command to shut down the service, then that should give you a shortcut to use that will do what you want. You might go to a command prompt and type "shutdown /?" to see the options available.
     
  10. newbino

    newbino Registered Member

    Joined:
    Aug 13, 2007
    Posts:
    377
    allizomeniz hi, I tried your settings and it still hangs at shutdown. Maybe if I post some screens you might be able to identify any errors I made.

    My .bat file is simply:
    NET STOP fitbit

    should I modify it? thanks
     

    Attached Files:

    • 1.JPG
      1.JPG
      File size:
      51.1 KB
      Views:
      23
    • 2.JPG
      2.JPG
      File size:
      35.1 KB
      Views:
      21
    • 3.JPG
      3.JPG
      File size:
      35.4 KB
      Views:
      19
  11. newbino

    newbino Registered Member

    Joined:
    Aug 13, 2007
    Posts:
    377
    this would indeed help me in reducing the number of clicks, my main problem is that I am so used to a different way of shutting down that from time to time I simply forget I have to click a .bat file.
    Now, I am not that old a dog that cannot learn such new tricks, but if I can avoid it ... :)
     
  12. allizomeniz

    allizomeniz Registered Member

    Joined:
    Aug 23, 2009
    Posts:
    903
    newbino, a couple of things you might check. Open the Event Viewer and go to Windows Logs>System. When the list opens up, look for the event ID 1074. Select it, and in the "General" tab below, read what it says and especially note the Shutdown Type, it should say "power off." If it doesn't, or if it seems related to a different type of event than shutdown, you'll have to find the right event. To do that, just shutdown taking note of the exact time (including seconds), then restart and open the Event Viewer, go to Windows Logs>System and look for the time you noted at shutdown in the Date and Time column. There should be an event listed for the exact time you clicked the shutdown button (or within a few seconds). That's the event you need.

    I also see the History tab in the Task Scheduler is disabled. You can enable it by running TS as Administrator (instructions here http://bcrawfordjr.wordpress.com/2009/08/31/opening-windows-7-task-scheduler/) then you can enable History in the "Actions" menu. In History you can see what happened. Did it try to start and fail or not even try to start. If it failed, you can view the Properties and see what it says.

    Did you create the Task while running TS as Adminstrator? If not, you might try creating it again while running TS in an elevated state as Administrator.
     
  13. allizomeniz

    allizomeniz Registered Member

    Joined:
    Aug 23, 2009
    Posts:
    903
    Hey again newbino. When I tested this before I didn't use a .bat like you're using, so I created one to stop the Windows Update service and tried it. It didn't work at first but I finally got it to work a couple times, the TS History said "task completed" at least. I'm not hanging like yours is though so I can't say if it'll solve your problem.

    There are two separate events with the ID 1074. They look almost identical except for one small thing, the reason code. There's no way to refine triggers by reason code in the graphic interface so I used XML. If you want to try it, instead of "Basic" in Triggers use Event>Custom>New Event Filter>XML>check the box at the bottom that says "Edit query manually." The code I used is:

    <QueryList>
    <Query Id="0" Path="System">
    <Select Path="System">*[System[Provider[@Name='USER32'] and (EventID=1074)]] and *[EventData[Data='0x0']]</Select>
    </Query>
    </QueryList>

    I had to type the whole thing, it wouldn't let me paste into the dialog but you might be able to on yours. If it doesn't work the first time you run it, try again. Sometimes TS is a little temperamental with new tasks.

    I hope that works for ya. If not I'd try some of the suggestions others have made or just put a shortcut in Quick Launch and be done with it. :D
     
Loading...
Thread Status:
Not open for further replies.