?
Solved

Create Desktop Icon that will restart a service in Windows 7

Posted on 2010-09-21
4
Medium Priority
?
695 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
[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
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 1500 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 500 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 92

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…
Suggested Courses

777 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