Hello,

We have a bunch of thin clients and are upgrading our terminal servers from 2003 to 2008 R2. 2008 R2 now creates a subkey named the TS Session ID for the session number and puts the "ClientName" in it. With that being said, I hacked at this a bit and it is working. Thought I would share and ask for some constructive criticism, as I am very much a hack at this. Thanks All.

GetSessionID() is a sweet little UDF by pearly

 Code:
$session = GetSessionID() 
? $session

$UserSID = "HKEY_USERS\" + @SID 

$ClientName = @WKSTA
	
If InStr(@PRODUCTTYPE,"Server") and InStr(@PRODUCTTYPE,"2008")
	$ClientName = ReadValue($UserSID + "\Volatile Environment\" + $Session,"CLIENTNAME")
ENDIF

If InStr(@PRODUCTTYPE,"Server") and InStr(@PRODUCTTYPE,"2003")
	$ClientName = ReadValue($UserSID + "\Volatile Environment","CLIENTNAME")
ENDIF


Edited by Skip (2011-08-03 05:22 PM)
_________________________
-sphilip