When working with CRM you may have a requirement to know the servername and install names with which you are working. 
System Options

There are a few nice techniques that we can use in ASP pages. For example the COM API has a method that allows us to check the contents of the custom_sysparams table. This table holds the settings which explain to CRM where such things as the Adobe Report Generator is found (used in Reporting), or where the templates and library files are stored, and it will even tell you where the new custom .NET dlls are stored.


The parameter that needs to be used in the above method is the value held in the parm_name field of the custom_sysparams table. An example is


which would return

C:\Program Files (x86)\Sage\CRM\CRM\Library\

With a couple of string manipulations you will have the install name, provided you haven't moved the library off to a different server!

ASP System Variables

But what may be the simplest way of establishing where your script is working is to use the Request.ServerVariables collection. If you don't have a handy reference guide for these then they can be easily listed using

var myServerVarCount = Request.ServerVariables.Count;
var KeyName;
for (var iLoop=1; iLoop<=myServerVarCount;iLoop++)
KeyName = Request.ServerVariables.Key(iLoop);
Response.Write("<LI><B>"+KeyName+"</B> is "+Request.ServerVariables(KeyName));
For example var myDIR = Request.ServerVariables("APPL_PHYSICAL_PATH"); This will return the path to the installation directory e.g. C:\Program Files (x86)\Sage\CRM\CRM\


The .NET API provides us with some easier techniques of establishing with which server and install we are working. The Dispatch object contains 2 properties useful to us in this case.

Dispatch.Host - returns the server name as a string
Dispatch.InstallName - returns the Install Name as a string