can I automate a program in services?

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

can I automate a program in services?

Post by thewolfe »

I sync my iPad and an iPod with iTunes every morning. ITunes does not recognize either of my devices until I stop and start "Apple mobile device" in services. I have uninstalled and installed iTunes a couple of times with no joy. Is there a way when I start my computer in the morning then can stop and start "Apple mobile device" automatically?
User avatar
Thenior
DBB Captain
DBB Captain
Posts: 667
Joined: Wed Oct 06, 2004 9:40 am

Re: can I automate a program in services?

Post by Thenior »

yeah, create a batch script that runs everytime you turn on your computer (just open notepad, save it as a *.bat file in %AppData%\Microsoft\Windows\Start Menu\Programs\Startup

Type one of the following:

To start a service, type:

net startservice

To stop a service, type:

net stopservice

To pause a service, type:

net pauseservice

To resume a service, type:

net continueservice
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Cool thanks, I'll give it a try.
User avatar
Spidey
DBB Grand Master
DBB Grand Master
Posts: 10808
Joined: Thu Jun 28, 2001 2:01 am
Location: Earth

Re: can I automate a program in services?

Post by Spidey »

You could also run that file using the scheduler, then you could have more options…like running at a certain time each day, instead of at startup.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

I sync my devices as soon as I start the computer so in case I have to leave the house I have ipad/ipod ready to go with.

But I need to look into the Scheduler so i have a better idea of what it does. Like I'd like to crerate a restore point every couple of weeks.......
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 16137
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Re: can I automate a program in services?

Post by Krom »

Windows creates restore points automatically far more often than every couple of weeks.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Well that's what I thought but if I'm not installing or updating not much is happening.

Image
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

DBB Captain, going to try a bat file but have a couple of questions. This is out of my purview.

1. If I add a "stop" and a "start" bat file in startup will windows know which one to do first?
2. To start the service I type "To start a service, type:net startservice" and then what? How do I specify what service.

Looked at the "Scheduler" but also got lost when trying to set it up.
User avatar
Sirius
DBB Master
DBB Master
Posts: 5616
Joined: Fri May 28, 1999 2:01 am
Location: Bellevue, WA
Contact:

Re: can I automate a program in services?

Post by Sirius »

1. It won't (or maybe it goes through in alphabetical order but I wouldn't rely on it). Put both commands in the same .bat file consecutively - that is at least guaranteed to do the job properly.
2. That comes from the "name" column in the Services list. In your case, assuming the service name is what you said in the first post, the commands should be as follows:
net stop "Apple mobile device"
net start "Apple mobile device"
I'm not certain whether you'll need to run the .bat elevated - you can try it manually first though, and it'll tell you if the commands failed. If they do fail you'll probably need to use task scheduler to get around that.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Image

Here's a pick of the Services. Bat file ran, no errors but didn't work.

Also tried "net stop the service "Apple mobile device" and net start the service "Apple mobile device"

No joy yet. May have to learn the "Scheduler" but that's down on my list of priorities.

Starting to build a new website with WordPress, still just going through the tutorials.
User avatar
Thenior
DBB Captain
DBB Captain
Posts: 667
Joined: Wed Oct 06, 2004 9:40 am

Re: can I automate a program in services?

Post by Thenior »

You don't literally use the phrase "net startservice", you'd use "net startactualnameofservice"

To find the name of your services, check the registry editor under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services , or if you double click the service Services.msc, you'll see the actual name.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Image
Here's a pic of the registery.

Not sure of actual name "Apple Mobile Device"?
User avatar
Sirius
DBB Master
DBB Master
Posts: 5616
Joined: Fri May 28, 1999 2:01 am
Location: Bellevue, WA
Contact:

Re: can I automate a program in services?

Post by Sirius »

Yeah, you'll need the one in the DisplayName value - that registry key is how net start figures out what binary corresponds to the service you want.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Well we got the correct name and no errors but no joy. Also, even after manually stopping and starting Apple Mobile Device in Services, I have to restart iTunes. but again thanks for the posts.
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 16137
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Re: can I automate a program in services?

Post by Krom »

You could try delaying the automatic startup of itunes, it is possible itunes is loading before the service is ready and so it can't sync (could happen especially if the computer automatically logs in).
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Also tried a separate bat file for "stop" and "start" ....no joy.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Delay startup....hummmmm!

I'll try WinPatrol to delay iTunes a bit, thanks.
User avatar
thewolfe
DBB Admiral
DBB Admiral
Posts: 1987
Joined: Tue Nov 05, 2002 3:01 am
Contact:

Re: can I automate a program in services?

Post by thewolfe »

Nope! It does look like iTuneshelperexe is supposed to recognize devices but I turned that on off and that didn't seem to help either. Starting and stopping "Apple Mobile Devices" is mightily fixed at this point.
Post Reply