Solved

Create Desktop Icon that will restart a service in Windows 7

Posted on 2010-09-21
4
670 Views
Last Modified: 2012-05-10
Hello,

We are running OpenVPN on our laptops to connect when out of the office.  Most of the time it works great, but every so often the OpenVPNService needs to be restarted for the connection to be made.

I have created a .bat file with:
Net Stop OpenVPNService
Net Start OpenVPNService

which works great on our WinXP machines.  But in Win7 the script doesn't work unless the .bat file is Run as Administrator.

Now I know that it's super easy to right-click on the icon and choose "Run as Administrator."  Unfortunately the sales reps that will use this icon twice a year will never remember this.

Is there an easy way to make it so the .bat could be double-clicked on and just work?

Thanks,
-John
0
Comment
Question by:nieblertech
  • 2
4 Comments
 
LVL 3

Expert Comment

by:celdridgeMadman
ID: 33731266
You should be able to the the properties of the application (the .bet file in this case) to be required to run as an administrator.
0
 
LVL 3

Accepted Solution

by:
celdridgeMadman earned 375 total points
ID: 33731283
Ah actually, no you can't. Silly windows 7 doesn't allow .bat files to tick the run as administrator tickbox. Maybe if it's just a simple script try using a bat-to-exe converter to have it as a .exe file instead (which you CAN tick run as administrator on). eg, http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html
0
 
LVL 4

Assisted Solution

by:cmartell
cmartell earned 125 total points
ID: 33731319
The "Run this program as an administrator" check box will be grayed out on the batch file properties but you can make a shortcut to the batch file and then set it on the shortcut's properties,
Right click the shortcut and choose Properties
Select the Shortcut tab
Press the Advanced button
Check "Run this program as an administrator"
0
 
LVL 91

Expert Comment

by:nobus
ID: 33732177
i believe  this is what you look for :  http://www.vistaclues.com/run-a-batch-file-as-an-administrator/
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Article by: Lee
Windows 7 Ultimate and Enterprise (and 2008 R2) introduced a new feature you may not be aware of - Boot from VHD.   Boot from VHD (or what Microsoft refers to asNative Boot allows you to install Windows to a VHD (Virtual Hard Disk) file that is t…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

708 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

12 Experts available now in Live!

Get 1:1 Help Now