start a service remotly

Hi,

I have a service running on a server that keep stopping at 6am each morning, when it stops it only take a couple of minutes to logon and restart the service by an administrator but at 6am I don’t want to be woken up do to this.
While I am looking into why it keeps stopping can anyone suggest a way of using a batch script or a way of starting a scheduled task (saved on the sever) from a workstations to start the service?

Regards,
hellblazerukAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

McOzCommented:
Why can't you just set up the service to restart itself when it fails, using recovery options?

https://technet.microsoft.com/en-us/library/cc753662.aspx
Thomas GrassiSystems AdministratorCommented:
you can use psservice from system internals

see this example

http://forum.sysinternals.com/psservice_topic5192.html

make sure the firewall give you access  to remotely start a service
hellblazerukAuthor Commented:
Hi,

I will try the psservice  idea,

I have tried the following but get the error:

Error opening Gateway on \\DC01:
The specified server does not exist as an installed service, why would this be?

C:\psservice\psservice \\DC01 -u **-p ** stop Gateway Service
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Thomas GrassiSystems AdministratorCommented:
try this see what happens

sc \\DC01 qc MyService
hellblazerukAuthor Commented:
tried:
C:\psservice\psservice sc \\DC01 -u admin -p *** stop qc Gateway Service

and get:
PsService v2.24 - Service information and configuration utility
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

PsService lists or controls services on a local or remote system.

Usage: psservice [\\Computer [-u Username [-p Password]]] <cmd> <optns>
Cmd is one of the following:
   query      Queries the status of a service
   config     Queries the configuration
   setconfig  Sets the configuration
   start      Starts a service
   stop       Stops a service
   restart    Stops and then restarts a service
   pause      Pauses a service
   cont       Continues a paused service
   depend     Enumerates the services that depend on the one specified
   find       Searches for an instance of a service on the network
   security   Reports the security permissions assigned to a service
Use the username and password to log into the remote computer in cases where
your account does not have permissions to perform the action you specify.

Omitting a command queries the active services on the specified computer.
Enter -? for help on a particular command.
Thomas GrassiSystems AdministratorCommented:
when you ran psservice for the first time did you agree to the terms?


C:\util\PStools>psservice stop /?

PsService v2.24 - Service information and configuration utility
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

Usage: psservice [\\Computer [-u Username [-p Password]]] stop <svc>
Stops the specified service.

tried:
 C:\psservice\psservice sc \\DC01 -u admin -p *** stop qc Gateway Service

is the service name correct?

use quotes

 C:\psservice\psservice sc \\DC01 -u admin -p *** stop "qc Gateway Service"
footechCommented:
Make sure you are using the serice name and not the display name for the service.  The service name is usually a short abbreviation of the display name and rarely includes spaces.  If it does, surround the name by quotes.

You can also use
Start-Service someservice (PowerShell)
net start someservice (cmd)
sc start someservice (cmd)

But if the service is crashing (and not just stopping gracefully), I'm with McOz in that you should set the recovery options.
Thomas GrassiSystems AdministratorCommented:
Added to the above

Yes finding out why the service is stopping or crashing in the first place would be a big concern.

What does the event log show for this service?  Application log, System Log
hellblazerukAuthor Commented:
Hi,

I will be investigating why the service keep crashing but not until Monday so don't want waking over the weekend,
The script is now working but I am not keen in the password being saved, is it possible to enter the user and password when being ran?
Thomas GrassiSystems AdministratorCommented:
If you set the script up with variables you can enter

c:\myscript  password    as example

or both user and password use two variables


Take a look at this

https://social.technet.microsoft.com/Forums/en-US/c23fd73c-e704-4a6c-9dc6-d99f82eb10d0/prompt-for-input-set-variable-in-powershell

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.