onsdag 23 september 2009


Warning! This note only makes sense for the Dynamics Ax developers out there. Specifically if you are setup up Enterprise Portal or something similar that uses the .Net Business Connector to connect to Ax.

A simple tool for verifying if you have a working Business Connector .Net setup.

Download it here. To run it you need the 13MB Microsoft.Dynamics.BusinessConnectorNet.dll, version 5.0.1 (2009, SP1) in the program directory.

Basically the code looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Dynamics.BusinessConnectorNet;

namespace BusinessConnectorTest
class Program
static void Main(string[] args)
Microsoft.Dynamics.BusinessConnectorNet.Axapta DynAx = new Microsoft.Dynamics.BusinessConnectorNet.Axapta();
Microsoft.Dynamics.BusinessConnectorNet.AxaptaRecord DynRec;

DynAx.Logon(null, null, null, null);
Console.WriteLine("Logon successful!");

DynRec = DynAx.CreateAxaptaRecord("CustTable");
Console.WriteLine("Create record successful!");

DynRec.ExecuteStmt("select firstonly * from %1");
Console.WriteLine("Select successful!");
Console.WriteLine(string.Format("Recid: {0}", DynRec.get_Field("RECID")));
catch (Exception ex)

Very simple, but still handy to have. The catch is the good part :). Gives you an idea of what is wrong.

This code uses the current user to logon. Use "runas" to change user.

fredag 11 september 2009

Find out the name of the AD server

Ever wondered which machine is the AD server of the machine you are using?

echo %logonserver%

Will tell you the machine name of the AD server or simply give you the current machine name back if you are not connected to a domain.

torsdag 10 september 2009


The lovely little tool setspn...

It has different command for different versions (new commands in windows server 2008).

It has very little error checking so it allows you to register duplicate SPN's which will ruin your kerberos authentication.

The nice view command "setspn -l " allows you to specify both a machine or a user as argument. The results are different and does not show the same information.


tisdag 8 september 2009

Verify Kerberos in a SQL Server installation

Use the SQL Server Management Studio, connect to the server (note you must NOT do this locally on the server). Execute this T-SQL:

SELECT auth_scheme FROM sys.dm_exec_connections WHERE session_id = @@spid;

It will return either "NTLM" or "KERBEROS".

More on Kerberos will follow...