Solved

Non Administrator to stop and start service.

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This is about my first experience with programming Arduino.
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 …
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…

759 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

20 Experts available now in Live!

Get 1:1 Help Now