Technology and troubleshooting.

Monday, February 29, 2016

Batch and VB Script to Run application as Administrator Privileges in user login

Batch and VB Script to Run application as Administrator Privileges in user login

This tutorial describes How to run application as administrator privileges in user login.

My Scenario:- One of our staff need Yahoo messenger but Yahoo messenger is working in proxy(Squid) It did so many troubleshooting in squid and exclude yahoo sites yahoo sites in proxy and Windows group policy but none of them is not helped me.

Finally I found a key Yahoo Messenger is start working in administrator Privileges in user mode.

 Yahoo! Messenger(Shortcut)->Right Click->Run as->Administrator Credentials 

The above stuff is resolved my issue I want to automate the process because I am interested to went user place login Yahoo messenger every time.

So I want to automate the process using Batch and VB script.

Here is script:-

Batch script save as .bat Example:- Yahoo.bat 

Note:- Save the Yahoo.bat file C:\ or D:\ Drive.

cd c:\
cd "C:\Program Files\Yahoo!\Messenger"
start YahooMessenger.exe

 VB script save as .vbs Example:- Yahoo.vbs

set WshShell = WScript.CreateObject("WScript.Shell") "runas /user:administrator C:\Yahoo.bat"
WScript.Sleep 100
WshShell.SendKeys "YOUR Administrator Password" 'send password 
WshShell.SendKeys "{ENTER}"  
WScript.Sleep 100

Note:- User can easily gain administrator password by click and Edit the Yahoo.vbs file for Security reasons Convert the .vbs file into Exe by using Vbs To Exe Converter

Vbs To Exe Converter



Now Right Click the Yahoo.exe send to -> Desktop (Create Shortcut).


I hope this information is useful for you. Please forgive any typos or incomplete sentences.


Post a Comment

Popular Posts