Get the Client Name of your (Remote) Machine in AX2012

In this short post I want to highlight how you can get the name of the client which is connected to AX 2012, even if you run your session via a RDP connection. For this purpose I wrote a small Job, that outputs the client name in an Infolog.


The first Info invokes the static global method computerName(),¬†which will return the client name from the machine that runs the AX 2012 client right now. Unfortunately, if you are running AX 2012 on a terminal server, it will return the hostname of that server, not the name of your actual “local” client.

So the second method makes use of some .NET code and reads the client name directly from the Environment class. The static method GetEnvironment() takes an argument as string, to get the client name, just pass “CLIENTNAME”.


In the screenshot below one can see the output, the first Info is from a terminal server, the info below from a local machine.

Get the Clientname of your (rdp) maschine



You may also like...

1 Response

  1. Daniel Zook says:

    FYI: If you need to assign the results of these CLR calls to an AX field or variable you need to marshal it by first storing the results in a System.String type variable and then assigning that variable to an AX variable (such as str) or field.

    Just a reference for anyone who finds this via Google…

Leave a Reply

Your email address will not be published. Required fields are marked *