|
|
|||||||
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! |
||||||||
|
|
|||||||
%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. |
||||||||
|
|
|||||||
nevermind the previous post. instead try setting "Run logon scripts synchronously" in the gpo on the server: User Configuration/Administrative Templates/System/Scripts |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
Have you tried @hostname instead? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
@hostname = name of my terminalserver, i need the name of the client from the user |
||||||||
|
|
|||||||
OK, how about %computername%? If you have MS office installed, read Code: HKCU\Software\Microsoft\Office\12.0\Outlook\Machine Name Code: HKCU\Software\Microsoft\Windows\ShellNoRoam\(Default) Code: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Distinguished-Name Code: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerName |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
hmmm, guess hama missed this. Can someone check this to make sure it is working as advertised? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
We have a W2K8r2 TS farm in the office - it works as advertised. I'd create & post a complete UDF without any dependency. Glenn |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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. I'll post back here when complete. Glenn |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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!) I should have time after lunch to knock it out and test. Glenn |
||||||||
|
|
|||||||
old farts being polite or what is this? :P |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
hmm. Why case 1 is @wksta? |
||||||||
|
|
|||||||
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. |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |