![]() If, on the other hand, if your VPN client is such that you can't connect via the command line, I'd look into AutoIT or other mouse/keyboard macro scripting languages to see if you can automate VPN connection. Take your batch file, put it (or a shortcut) on your Desktop or wherever, and then you have a one-click "connect to the VPN and then open Remote Desktop" app. Virtual Private Network (VPN) is a technology that enables local-like communications over the internet and OpenVPN is an open-source implementation of this. If you wanted to be really fancy, instead of a sleep to verify connectivity, you could have a ping to some resource that's only accessible over the VPN, and have the script return an error if that ping doesn't succeed. Once you have that info, write a batch file which invokes the VPN client, probably sleeps a few seconds to make sure the VPN link is good, and then calls the remote desktop client from the command line. This might require you to store your password in plaintext in a batch file or script, however. For example: An圜onnect, the generic Cisco client, and the Windows VPN client all support this. ![]() Cisco An圜onnect), use Google to find commandline options for that product to see if you can connect with a single command. If you have a standalone VPN client program (i.e. Double-click on Allow log on through Remote Desktop Services. Navigate through the console tree to Computer Configuration Windows Settings Security Settings Local Policies User Rights Assignment. You can choose to start the script minimised if you don't want the user seeing the cmd window, but I like to leave it visible so they can see if there are any errors when connecting to the VPN. Open the Group Policy Object Editor by entering the GPEdit.msc command at the Windows Run prompt. ![]() I tend to put a shortcut to the batch script on the desktop and change its icon to the normal RDP one (from C:\Windows\System32\mstsc.exe). As soon as the RDP session is closed the final command will run to disconnect the VPN. We've covered several solutions for accessing your desktop remotely over the Internet. To access Remote Desktop over the Internet, you'll need to use a VPN or forward ports on your router. By default, Windows Remote Desktop will only work on your local network. Replace 'user' and 'pass' in the first line with the actual username and password to connect to the VPN (even if you chose to have the credentials saved when you created the VPN, Rasdial requires you enter them).īecause batch scripts run synchronously rasdial will complete connecting to the VPN before opening the RDP file, and the whole time the RDP session is open the batch script will be waiting. Option Two: Expose Remote Desktop Directly to the Internet. Replace "VPN Name" with whatever you called your VPN connection when you set it up. Rasdial is builtin to Windows and is used to connect and disconnect. offĮcho Finished - disconnecting from VPN. I realise this question is very old but thought I'd add a method for anyone that stumbles across it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |