Page 1 of 2 12>
Topic Options
#204423 - 2012-03-08 03:54 PM kix with 2008r2 terminalserver + %clientname%
hama007 Offline
Fresh Scripter

Registered: 2008-05-13
Posts: 5
hi have a problem with windows 2008 terminalserver and kix

on my running windows terminalserver 2003 i can use in the kix %clientname%
on the new windows 2008 ts i run my script and have no output for %clientname%

i open cmd.exe and start my kix script manual, the variable "clientname" set and my script is running good!

Top
#204427 - 2012-03-08 05:29 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: hama007]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
%clientname% is not a kixtart variable but a environment one.

there is the fact that if you are using admin session, the %clientname% should always be empty.
_________________________
!

download KiXnet

Top
#204428 - 2012-03-08 05:38 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nevermind the previous post. instead try setting "Run logon scripts synchronously" in the gpo
on the server: User Configuration/Administrative Templates/System/Scripts
_________________________
!

download KiXnet

Top
#204452 - 2012-03-13 11:45 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: Lonkero]
hama007 Offline
Fresh Scripter

Registered: 2008-05-13
Posts: 5
the problem is the same!!!

any idee?

in the kix file i do this

$client = %clientname%

in windows 2003 it runs in windows 2008 r2 not


Edited by hama007 (2012-03-13 11:54 AM)

Top
#204453 - 2012-03-13 01:35 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: hama007]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
Have you tried @hostname instead?
Top
#204454 - 2012-03-13 02:43 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: BradV]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I still suggest "my" solution. cause it was the one given by MS. ;\)
just in case you should see the effective policy for logged in user.
_________________________
!

download KiXnet

Top
#204455 - 2012-03-14 08:32 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: Lonkero]
hama007 Offline
Fresh Scripter

Registered: 2008-05-13
Posts: 5
@hostname = name of my terminalserver, i need the name of the client from the user
Top
#204456 - 2012-03-14 11:15 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: hama007]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
OK, how about %computername%? If you have MS office installed, read
 Code:
HKCU\Software\Microsoft\Office\12.0\Outlook\Machine Name
I also found
 Code:
HKCU\Software\Microsoft\Windows\ShellNoRoam\(Default)
and
 Code:
 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Distinguished-Name
or
 Code:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerName
There are many more. I don't have a citrix setup, so I can't really search for any specific entries relative to that.

Top
#204457 - 2012-03-14 12:26 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: BradV]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I have not tested this personally as I don't have a Terminal Server environment, but another member posted the code, and I converted it to a UDF... please follow up and say if this works for you. If so, I'll post this to the UDF Forum.

Clientname() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=202786#Post202786

*Requires*
GetSessionID() -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=137632#Post137632

How to use UDFs -
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=81943#Post81943

The rest of the UDFs are here -
http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1


Top
#204473 - 2012-03-16 04:21 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
hmmm, guess hama missed this. Can someone check this to make sure it is working as advertised?
Top
#204481 - 2012-03-16 10:57 AM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
BradV Offline
Seasoned Scripter
****

Registered: 2006-08-16
Posts: 686
Loc: Maryland, USA
There is a citrix setup at one of our other buildings. I probably won't be able to get to it until some time next week. I can test it then.
Top
#204484 - 2012-03-16 01:47 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
We have a W2K8r2 TS farm in the office - it works as advertised. I'd create & post a complete UDF without any dependency.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204485 - 2012-03-16 02:37 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I was going to merge them before I even posted above, but I looked at getsessionid... I believe it is recursive. The biggest problem I have if I wr-write it, I don't have any way to test it.
Top
#204487 - 2012-03-16 02:55 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'll take a look at it and see if I can bring them together and test. Then we can post it with references to the UDF that were blatantly plagerized. \:D

I'll post back here when complete.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204490 - 2012-03-16 03:24 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Glenn Barnas]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Sometimes I wonder what my eyes are seeing \:\( I just looked again, and don't see what I thought made it recursive. WTH? Old age?

Please do the "hard work" Glenn... it has to be easier than me doing it and asking someone/you to test it. \:\)


Top
#204491 - 2012-03-16 03:27 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Considering I probably have a decade or so on you... I just bit my tongue regarding the whole Recursive thing! (thought I missed it, actually!)

\:D

I should have time after lunch to knock it out and test.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204500 - 2012-03-16 07:03 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
old farts being polite or what is this? :P
_________________________
!

download KiXnet

Top
#204501 - 2012-03-16 07:03 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Glenn Barnas]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
OK - looking at this...

%CLIENTNAME% is populated on my server, so I'm adapting the UDF to use this if defined and only proceed with more complex methods if not.

Does anyone know why HKU\@SID is used instead of HKCU to get to the Volatile Settings? At first blush, it seems more complex than necessary.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204503 - 2012-03-16 07:37 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Glenn Barnas]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
comes back to the fact that clientname should be always populated, unless logonscript is not ran in sync.
after logon, it is populated when in the session you go and check it out.

that said, your approach should add the foolproof aspect to it.
_________________________
!

download KiXnet

Top
#204608 - 2012-03-29 08:40 PM Re: kix with 2008r2 terminalserver + %clientname% [Re: Lonkero]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Okay so if I read the comments right, I think I have included the changes...

Someone want to test this?

 Code:
function ClientName()
  select
    case len(%clientname%)
      $clientname=%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
endfunction

Top
Page 1 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.08 seconds in which 0.026 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