Novell is now a part of Micro Focus

Detecting Login on a MetaFrame Server

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 9 Jul 2003

We've received some excellent additional information in the quest for easy ways to tell if a person is logging in from a local machine or a MetaFrame server. However the tips we've posted about Detecting Login on a MetaFrame Server seem not to work for the newest version. As Tom K. wrote: We now have a MF 1.8 for Windows 2000 server and the same methodology doesn't seem to work there. We asked for suggestions for the new version, and got some great ideas, which we have added to the list.

Here are some suggestions from cool readers:

James Redmore

First off I'd like to say this is a great web page, and I think Novell has been doing great things recently! I was reading a Q&A and thought there was a better solution. The original question and answer was:

Detecting login on MetaFrame server

Q: PF wrote: How can I check in the login script to determine if the user is logging in from a local machine or on my MetaFrame server?

A: One way that we have heard of to distinguish between NT and MF is to set a system environment variable on the MF box and check for it in the login script.

All versions of Citrix Winframe and Metaframe use an enviroment variable called %WINSTATIONNAME%. %WINSTATIONNAME% identifies which tcp/ipx/netbios port you use to connect to the Citrix server. The beautiful this about this variable is that it exists on all versions of Winframe/Metaframe and even exists on the console session!

When I want to check if a user is logged into Winframe/Metaframe I verify that %WINSTATIONNAME% has a value.


I believe this information has been published on Citrix's web page.

If you have any questions you may contact James at

Diane DelVecchio

The first tip under Detecting Login on a Metaframe Server is close, but doesn't work. Actually, the syntax for the Novell login script should be:

if <winstationname> <> "" then

command(s) to execute if logging

in at citrix box


command(s) to execute if NOT

logging in at citrix box


The first line looks at the DOS environment variable "winstationname" and determines if it is <> (not equal to) blank. If it has a value, then you are on a Citrix box. When using a DOS environment variable in a login script, drop the % and enclose it in brackets <>.

If you have any questions you may contact Diane at

Tom Eggletson

I have found that our MetaFrame server registers itself with NDS with MAC address 000000000001. So check for this with the P_STATION variable.

Jason Czepiga

Here is another tip on how to tell if a user is logging in from a workstation or your Terminal Server/Metaframe server.

Put the following qualifier in the login script around lines that you do NOT want to run for TS/Metaframe users when they login.


(Where "P" is the drive letter of the system drive of yous TS/Metaframe server.)

Or if you want something to only run when they login from TS/Metaframe:


This is a default variable set by Microsoft for where the operating system files are located. So unless you are getting creative with your installs, this should be consistently different between OS's.

Frank Kestrel NEW

About Jason's suggestion: It's almost correct. For Citrix Metaframe on Windows 2000, the default system root is s:\winnt. But for some reason the bypass still seems to work, I think maybe just because of the drive letter. Thought your readers should know.

John Bennett

Here is another tip for checking if a user is logging into Windows Terminal Server. Check for the existence of chgusr.exe. This file should only exist on TS.

So you could use something similiar to:




Robert Canis

For detecting a MetaFrame connection, why not look for the IP address with the $NETWORK variable? That's what we do here for all of our login scripts. This works great for a large WAN when you only want to run nalexpld when they are at the home front.

Ray Larson

Another tip for distinguishing a Terminal Server on Login. I added a Registry key TermServer under HKLM\Software\Novell\Login

In the login script I added a Regread command. If TermServer = 1 then it executes the section for my Terminal Server clients and exits. If the key is not present it ignores the section and continues to normal login script.


REGREAD "HKLM,SOFTWARE\Novell\Login,TermServer"
If "%99" = "1" then
MAP R T:=\\server\volume
Map h:=\\server\volume
Map i:=\\server\volume

Diane Stuhr

I can't resist adding my method of determining if user is logging in to a Terminal server. I go into Advanced Properties in the Novell Client on the Terminal server and set the DOS Name to WTSRV. Then in the login script I use IF OS="WTSRV" THEN

This has come in handy because I set the HOMEDRIVE, HOMEPATH, and HOMESHARE to each user's personal directory on a Novell server in the Novell login script.

If for some reason the user has to have different HOMEDRIVE, HOMEPATH and HOMESHARE for different Terminal Servers then I just have to use a different DOS Name.

If you have any questions you may contacvt Diane at

David Reimers

There's another way to test for Terminal Server/MetaFrame on Windows 2000 - using the registry. Look for the key

HKEY_LOCAL_MACHINE\Software\Novell\Print\ IsTerminalServer.

A value of 1 means Terminal Services are installed, and 0 means they are not.

Ryan Flud

Typically there aren't that many MetaFrame servers on the same network so using the %P_station variable in the login script isn't very difficult to setup. In response to Tom Eggletson's message:

I have found that our MetaFrame server registers itself with NDS with MAC address 000000000001

In our environment we were able to just use the MAC address as reported by the NIC.

Graham Prentice

What we use successfully on Win2k & Metaframe 1.8 to detect a Terminal Server during login is:

On the Terminal Server, Novell client properties, change 'Short Machine Type' from IBM to CTX.

In the login script:


One gotcha is when running RCONSOLE on the terminal server, the executable is looking for a file called CTX_RUN.OVL.

This should be using IBM_RUN.OVL. We copied the file to CTX_RUN.OVL and had success.

If you have any questions you may contact Graham at

Erwin van Bergen

Here it is. Check TID #10022340.

Create a WinStation Variable at your Citrix Server and name it whatever you like.

Requirements: ZEN Works 2.0 FULL VERSION or Higher!

Kevin Hurni NEW

Here's some info from MS Knowledgebase Q152078:

HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\ ProductOptions\ProductType

  • The values are:
    • WinNT (which equals Windows NT Workstation)
    • LanmanNT (is an NT server domain controller)
    • ServerNT (stand-alone NT server)
    • Terminal Server (NT Server 4.0 Terminal Server)
    • Enterprise (NT server 4.0 Enterprise Edition)

    Now for checking for MetaFrame, that should be easy. There are a LOT of registry settings (HKEY_Local_machine\software\citrix . . .) that can be used.

    If you have any questions you may contact Kevin at

    Brenda Sorenson

    James Redmore's info about using the WINSTATIONNAME for MF 1.8 is a great idea and we are using that. However, Metaframe XP which runs on W2K does NOT have that variable. Metaframe XP DOES have a variable called SESSIONNAME that can be used the same way.

    Phil Helmling

    You could also use the following to detect if the user is logging in to a Citrix server:

    REGREAD "HKLM,SOFTWARE\Citrix\IMA,Neighborhood"
    If "%99" = "Farm_1" Then Begin
          * Continue

    where "Farm_1" = Citrix Farm Name and "command" = command to run if true.

    If you have any questions you may contact Phil at

    Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

  • © Copyright Micro Focus or one of its affiliates