Monday, February 04, 2013

Open and close a VPN connection from command line

Goal:  Use FinalBuilder to be able to deploy an application to a customers site over a VPN connection.

Create VPN Entry in Windows 7:  Short Video





Clear the check boxes for Display progress while connecting and Prompt for name and password, cert, etc.

So now to connect and disconnect via command-line is very simple using rasphone.

Connect:

  • PS C:\Users\scramer.AKTION> rasphone -d MyConnection

Disconnect:


  • PS C:\Users\scramer.AKTION> rasphone -h MyConnection

Add this into Final Builder by using a powershell action:



References:

Software Used:

  • Windows 7
  • FinalBuilder 7
  • RasPhone.exe



Wednesday, January 30, 2013

The setup routines for the Timberline Data ODBC driver could not be found.

So all of the sudden this line started failing:

SQLConfigDataSource(WinHandle, (int)RequestFlags.ODBC_CONFIG_DSN, "Timberline Data", connStrIn);

With this message:

---------------------------
Microsoft ODBC Administrator
---------------------------
The setup routines for the Timberline Data ODBC driver could not be found.  Please reinstall the driver.
---------------------------
OK   
---------------------------

But it just worked yesterday!!!!  So I re installed the drivers and reran the code.  And it still fails.

So what did I change?  Well after a few hours we found out the problem.

Visual Studio Platform Target.


Typically best practices are to use AnyCPU but for some reason we noticed this app was on x86.  We promptly changed it to Any CPU.  Well that was the reason for the failure.

The ODBC driver we are trying to use does not have a 64bit version. So when I built and executed on my 64 bit development machine it chose the 64bit ODBC driver.  When I select x86 I get the 32bit ODBC driver.

I confirmed this by using the two ODBC Administrator tools in windows.


The 32 bit one allowed me to config and the 64 bit one raises the exact same error as my application.

Generating GUIDs in Visual Studio QUICKLY!

If you work with WIX installers you will want and easy way to create and paste guids into your code.

Visual Studio 2012 has a create GUID tool but it is too slow.  I wanted a simple keystroke.

After looking at addins to VS2012 I decide it was too much trouble.

The 3 minute solution:
Install AutoHotkey,  and let it create a sample script for you the first time it runs.

Replace that script with the one found here.



And now Window-Shift-G does exactly what I wanted.

Thanks to both AutoHotKey and Ian Prest
References:
http://www.autohotkey.com/
https://gist.github.com/3845947