Solved

Create Desktop Icon that will restart a service in Windows 7

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
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…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

689 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