Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting and stoping services remotely PLEASE HELP!!

Status
Not open for further replies.

tcpipgeek

IS-IT--Management
Feb 21, 2007
19
US
I am in a Windows server 2003 standard domain. I have a user who needs to run a license program for a mapping software on a file server on my domain. I need to be able to give him a way to be able to start and stop the licensing program services on the file server as the licensing program sometimes does not release the license like it should. My problem is that I need to be able to allow him stop and start services with out giving him access to the secure server room. Is that a script or command or something that will let me put a shortcut on his desktop that will allow him to start and stop the services for the program? without giving a user to much access to the server.
 
Although it used to be available in the Windows 2000 Resource kit (don't know what replaced it in Win2K3) you could use the NETSVC command in a batch file to stop/start a service remotely. If the user has the appropriate rights to stop/start the service all you need to do is
NETSVC <servicename> \\servername /stop
NETSVC <servicename> \\servername /start

Hope this helps.
 
Actually just copied the tool to one of my Win2K3 servers and it seems to run fine
 
The SC command built-in to Windows 2003 and XP can also stop services remotely:
sc \\servername stop servicename
 
Hello, I am sorry for the late reply I had to leave on on emergency. I have tried the above recommendations and I dont think I am doing it correctly. Is this a command I can run from the command line on the pc where the user sits?
 
Yes it can be run at the command line or in a batch file. Bare in mind though that the user has to have the appropriate rights to stop/start services in the first place for this to work.
 
I see, Thanks very much for the reply. is there a way to add this user to start stop just certain services? without allowing them to do so with other services? I only want him to be able to start and stop the licensing services with the software he is using.

Thanks very much for your help.
 
Unfortunately you just can't provide the right to start/stop certain services and not others. I recommend the following;

1. Create a service account for the licensing service and give the right to logon as service
2. Run the SC or NETSVC command using the /RUNAS:serviceaccount where serviceaccount is the account you created to manage the service.
OR
You can eliminate having the user do this by creating a scheduled task to stop/start the service on the server at different intervals during the day

Hope this helps.
 
Better solution in my opinion is to use WMI to do it.

I've done this for customers in the past, create a web page with a button to click. The button fires off the WMI code which can run in the Admin context by setting the Anonymous user ID for the page to be an ID with elevated rights. By doing it this way your user needs no added priviledges.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Hey Mark, that sounds pretty cool. Can you share the code with us? Thanks.
 
Search the VBScript forum, I may have posted an early version of that code there. The final version is reserved for my Admin Script Pack which is for my subscribers so I can't share that sorry.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top