Tech Support > Microsoft Windows > Help and Support > How can I remotely stop Windows service, do some stuff, and start the remove service again.
How can I remotely stop Windows service, do some stuff, and start the remove service again.
Posted by anonieko@hotmail.com on October 27th, 2005


How can I remotely stop a Windows service, do my stuff, and start the
remote service again.?

>
> You need to have a utility.
>
>


1. First download the utility psservice.exe
from pstools package of SysInternals site

Visit: http://www.sysinternals.com/Utilities/PsService.html
http://www.sysinternals.com/Utilities/PsTools.html

Run a batch file that loops until the service is stopped
do your process and start the service again



2. Assuming the naem of remote machine is MACHINE_ABC
and the windows service is MyWindowService


Here is the batch file:
-----------------------------------------------------

:start
psservice.exe \\MACHINE_ABC stop MyWindowService
if errorlevel 1 goto :start

rem -----------------------------------
rem do your stuff here
rem -----------------------------------


if errorlevel 1 goto :start
:restart
psservice.exe \\MACHINE_ABC start MyWindowService
if errorlevel 1 goto :restart


Similar Posts