Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Non Administrator to stop and start service.

Posted on 2006-11-01
2
Medium Priority
?
2,426 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 1000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Make the most of your online learning experience.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

618 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