S h o r t S t o r i e s

// Tales from software development

Executing a command on Windows startup

leave a comment »

I keep overlooking the extended functionality of Windows Scheduled Tasks and here’s another example…

I want a particular Windows server to automatically connect to a VPN when the server starts. Not when someone logs on but when Windows starts.

The RASDial command can be used to connect to a VPN, e.g. rasdial “Head Office VPN” username pa$$word

The problem is, how to execute this without a logged in user ?

The Schedule tab of the scheduled task properties dialog has options for At System Startup, At Logon, and When Idle, as well as the more commonly used Daily, Weekly, Monthly options:


Alternatively, a scheduled task that runs at Windows start up can be created using the SchTasks command line tool:

schtasks /create /tn “Start VPN” /ru SYSTEM /sc ONSTART /tr “rasdial \”Head Office VPN\” username pa$$word”



Written by Sea Monkey

September 17, 2014 at 8:00 pm

Posted in Environments

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: