Solved

Non Administrator to stop and start service.

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exchange and Third Party application. 8 68
stringclean challenge 26 70
base64 decode encode 12 119
groovy example issue 10 90
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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 …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now