Get Windows Computername and Username using .NET

You can use .NET to get client info like Computername and Username of both the server and the client.

Create a variable of type DOTNET to System.Environment in mscorlib.
If you set RunOnClient to Yes, you get info from Windows Client maschine, if not you get info from the NAV Server.

2017-05-10_1447

Lets see some examples:

// Get computername
MESSAGE(Enviroment.MachineName);
// Get username (without domain)
MESSAGE(Enviroment.UserName);
// Get domain
MESSAGE(Enviroment.UserDomainName);
// Check if the running client is 64-bit
MESSAGE(FORMAT(Enviroment.Is64BitOperatingSystem));

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