Page 2 of 2 <12
Topic Options
#204609 - 2012-03-30 02:44 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm. Why case 1 is @wksta?
_________________________
!

download KiXnet

Top
#204610 - 2012-03-30 04:10 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
That's how it was in the original. No way for me to test... just trying to get this done. \:\)

Seems like if you were running this in a normal logon script you might have a mix of terminal servers clients and regular pc users. I suppose it might make sense to return the pc name for the pcs.

Top
#205965 - 2012-10-09 04:26 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Here is an updated version (but still untested) that allows you to find the clientname in the XenDesktop as well. Someone with XenDesktop or any of the other environments please try this out and post your results.

 Code:
function ClientName()
  Dim $AltRegView
  $AltRegView=setoption("WOW64AlternateRegView","On")
  select
    case len(%clientname%)
      $clientname=%clientname%
    case readvalue("HKLM\Software\Citrix\ICA\Session", "ClientName")
      $clientname=readvalue("HKLM\Software\Citrix\ICA\Session", "ClientName")
    case InStr(@PRODUCTTYPE,"Server 2008")
      Dim $s_sessionid, $iIndex, $sessionid
      $s_sessionid = SubStr(%TEMP%,1+InStrRev(%TEMP%,"\"))
      While $s_sessionid <> ""
        $iIndex = InStr("0123456789ABCDEF",Left($s_sessionid,1))
        If $iIndex
          $SessionID = $GetSessionID*16+(Cint($iIndex-1))
          $s_sessionid = SubStr($s_sessionid,2)
        Else
          $SessionID = 0
          $s_sessionid = ""
        EndIf
      Loop
      $ClientName = ReadValue("HKCU\Volatile Environment\" + $sessionid,"CLIENTNAME")
    case InStr(@PRODUCTTYPE,"Server 2003")
      $ClientName = ReadValue("HKCU\Volatile Environment","CLIENTNAME")
    case 1  
      $ClientName = @WKSTA
  endselect
  $AltRegView=setoption("WOW64AlternateRegView",$AltRegView)
endfunction

Top
#207539 - 2013-07-29 07:59 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
I checked this in my lab:

 Code:
O/S          Env Var Set       Result
Server 2K3      Yes            Success
Server 2K8r2    Yes            Success
Server 2K12     No             Success


Glenn


Edited by Glenn Barnas (2013-07-31 01:39 AM)
Edit Reason: better format
_________________________
Actually I am a Rocket Scientist! \:D

Top
#207562 - 2013-08-02 03:05 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
And to follow up.... here is the link to the UDF posted in the UDF Forum. The most current version will be there.

http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=207561#Post207561

Special thanks to Glenn for his time and willingness to check it out. Also, thanks to everyone who contributed on this function as this truly was a community effort.

Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.04 seconds in which 0.016 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org