Solved

Non Administrator to stop and start service.

Posted on 2006-11-01
2
2,420 Views
Last Modified: 2008-01-09
I want to use the following script to stop and start a service on a remote machine.
Administrators can successfully run it but non-administrators cannot.
Is there a way to modify the script to allow non-administrators to run the script?

Set objWMIService = GetObject("winmgmts:{" & _
"impersonationLevel=impersonate}!\\remoteserver\root\cimv2")
Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service")

' WMI and VBScript loop
For Each objService in colListOfServices
      If ucase(objService.name)="TARGETSERVICE" Then
            objService.StopService()
            WSCript.Sleep 15000
            objService.StartService()            
      End If
Next
0
Comment
Question by:tonySchlein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 7

Expert Comment

by:yotamsher
ID: 17852554
one interesting product that might do the job for you is :
http://www.rivernorthsoftware.com/startstop/features.aspx
0
 
LVL 7

Accepted Solution

by:
yotamsher earned 250 total points
ID: 17852773
Hey tonySchlein

if you want to stop/start one specific service, you could set it permissions to allow all users to do it.
use subinacl.exe from Microsoft, get it here:
http://www.microsoft.com/downloads/details.aspx?FamilyId=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&displaylang=en
here is an article how to do it:
http://support.microsoft.com/kb/288129

I hope this will do.

Yotam
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question