Hi everyone. I've been trying for a couple of days to figure this one out and I'm stumped. I want to run BMC Track-It's audit.exe with the /Q parameter if a user logs into a desktop or laptop computer. I do not want it to run if they log into a terminal server. Right now this is not working, it runs no matter what they log into.

So far I've used this:
 Code:
;  - check if logon to Wintendo or WinNT
;  @InWin - 1 = Windows NT; 2 = Windows 9x 
;  - check if logon to Server or Workstation
;  PRODUCTTYPE - WinNT = Workstation, ServerNT = Member Server, LanmanNT = Domain Controller
;
IF @InWin = 1 ;Not Wintendo
	$PRODUCTTYPE = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\PRODUCTOPTIONS","PRODUCTTYPE")
	;  if not Workstation, just exit without notice
	if $PRODUCTTYPE <> "WinNT"
		Exit 1
	ENDIF
ENDIF

which I got from Citrix and/or Terminal Server Client Collection

If I log into a PC it works as it should, meaning that the audit occurs. If I log into a server, however, the server ends up being audited and that is not what I want.

For testing I'm using 2 scripts. The first is a batch file that is placed in the logon script field of the Profile tab in the test user's Active Directory (AD) object. That script is named tiaudit.bat and it runs these commands:

 Code:
*************************************************************************************
if not exist %systemroot%\system32\kix32.exe copy \\Netfiles5\update$\utils\kix32.exe %systemroot%\system32\kix32.exe >nul
if not exist %systemroot%\system32\wkix32.exe copy \\Netfiles5\update$\utils\wkix32.exe %systemroot%\system32\wkix32.exe >nul

%systemroot%\system32\kix32.exe \\woodruffcenter.org\NETLOGON\tiaudit.kix
*************************************************************************************

The tiaudit.kix script looks like this:
 Code:
*************************************************************************************
IF @InWin = 1 ;Not Wintendo
	$PRODUCTTYPE = READVALUE("HKEY_LOCAL_MACHINE\SYSTEM\CURRENTCONTROLSET\CONTROL\PRODUCTOPTIONS","PRODUCTTYPE")
	;  if not Workstation, just exit without notice
	if $PRODUCTTYPE <> "WinNT"
		Exit 1
	ENDIF
ENDIF

run "\\servername\sharename\audit.exe /Q"
*************************************************************************************

What am I missing or doing wrong? I can't figure this out... 8(


Edited by Mart (2015-09-01 09:20 AM)
Edit Reason: Please use code tags when posting code.