Starting programs with administrator rights at login

With the introduction of UAC in Vista, launching a program that requires administrative rights on Windows startup (when you first log in) has become more difficult. One solution that has been doing the rounds is to use the Task Scheduler as a workaround. What a mess! Provided you are not running a 'home' edition of Windows Vista/7, I have found what I believe is the cleanest and easiest way to achieve this (for all users only):

1. Start->Run-> "gpedit.msc"

2. User Configuration->Windows Settings->Scripts (Logon/Logoff)

3. Double-click 'Logon', and add entries for each of the applications you want launched.

Group Policy Logon

The applications you define in here will be launched with administrator rights when anyone logs on without any UAC dialogs being displayed.  

Note: This method cannot be used for specific users, it applies to all users. 

Remote Desktop via VPN

For many programmers and IT professionals, remote access via VPN to machines in their corporate network is a routine activity. This activity usually involves launching a VPN client (e.g. ShrewSoft VPN Client), entering a password, waiting for the VPN to be connected, then launching the remote desktop client. I have written a small executable to help automate that process, called DirectToDesktop.

The program launches your VPN client with the specified arguments and then starts a remote desktop session to a specified computer as soon as that machine can be pinged.


DirectToDesktop.exe <pathToVpnClient> <vpnClientArgs> <hostName> [pathToLookAlive]

<pathToVpnClient> – E.g. “C:\Program Files\ShrewSoft\VPN Client\ipsecc.exe”
<vpnClientArgs> – Args to pass to the VPN client.  E.g. “-r \”Your Company.pcf\””
<hostName> – The name/IP of the computer inside the VPN to remote desktop to.
[pathToLookAlive] – (optional) Install Look Alive to view connectivity status of the remote computer in the system tray.  E.g. “C:\Program Files (x86)\Zorn Software\Look Alive v1.24\LookAlive.exe”

Note: I’ve only tested the program with the built-in Windows 7 VPN client and ShrewSoft VPN Client, but in theory it should work with any VPN client that accepts command line arguments.

Just save DirectToDesktop.exe to any location on your hard disk, and add a shortcut to it using the above command line arguments. Run the executable without passing any arguments to view a help/about window.

Example Usage
After you have set up a VPN connection, you can use the following syntax if you are using either of the following clients:

Windows 7 VPN client:

directtodesktop.exe rasdial "Your VPN Profile Name" YourRemotePCNameOrIp

ShrewSoft VPN client:

directtodesktop.exe "C:\Program Files\ShrewSoft\VPN Client\ipsecc.exe" "-r \"Your Company.pcf\"" YourPCName