Shortcut to run application with local admin privileges.

shlafrock
shlafrock used Ask the Experts™
on
I've got a program which from time to time needs to be run with local administrator privileges, I tried changing registry and folders permissions, but it seems that it just has to be run as admin .  

So maybe I can change the shortcut to this application so it will be always run as another user ( with admin privileges ) ?

I cannot use the password in plain text like echo password | run as ... etc ..
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Meir RivkinFull stack Software Engineer

Commented:
you can use this free software to encrypt the password and run your batch with local admin privileges:
http://www.softtreetech.com/24x7/archive/53.htm
can you right click and do run as? can the user know the credentials?

look into TQC run as as a way of encryption and running as admin

http://articles.techrepublic.com.com/5100-10878_11-5031897.html
Use this vb script  for running the program as local admin ...
here i started command prompt as admin ...replace that with the path of your program
------------------------------------------------------------------------------------------------------------
Set WshShell=WScript.CreateObject("WScript.Shell")
strCmd="C:\WINDOWS\system32\cmd.exe"
strUser="%computername%\your admin account"
strPass="Your admin password"
set WshShell=CreateObject("WScript.Shell")
WshShell.Run "runas.exe" & " /u:" & strUser & " " & strCmd
WScript.Sleep 1000
WshShell.Sendkeys strPass & "~"

---------------------------------------------------------------------------------------
encrypt this vb script to vbe using the "vbs to vbe convertor "which is easily available
and change its icon or create a shortcut and whatever u want ....
TechnoChatWintel Administrator / Cloud Computing

Commented:
You can easily create a exe file to do the same using AutoIt.

AutoIt:
http://www.autoitscript.com/autoit3/index.shtml

Attached code for your refferance.

Thanks
Saugata
Local $sUserName = "Username"
Local $sPassword = "Password"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)

Open in new window

Wintel Administrator / Cloud Computing
Commented:
On above code, CMD will execute with your local admin user id and password.

Two more sample added.

Thanks
Saugata

Code 2>Notepad
---
Local $sUserName = "Username"
Local $sPassword = "Password"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, "notepad.exe", @SystemDir)


Code 3 > Using Path from ProgramFiles
Local $sUserName = "Username"
Local $sPassword = "Password"

; Run a command prompt as the other user.
RunAs($sUserName, @ComputerName, $sPassword, 0, @ProgramFilesDir & '\WinSCP\WinSCP.exe')

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial