Solved

Non Administrator to stop and start service.

Posted on 2006-11-01
2
2,423 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

Independent Software Vendors: 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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans

717 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