Solved

Create Desktop Icon that will restart a service in Windows 7

Posted on 2010-09-21
4
672 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SPAM and Ransomware and Backup 11 87
Suggestions for Calendar app or system for a PC (not cloud-based) 8 78
adobe acrobat scaning 9 49
PC not downloading updates 9 44
If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

911 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

21 Experts available now in Live!

Get 1:1 Help Now