|
|
|||||||
Hi all, We have a bunch of users logging into a CITRIX session. When they login ... we want a KIX script to run a SQL query based on the remote computers workstation name. I have been using @wksta but it seems to want return the name of the server. Any thoughts?? Faithfulman |
||||||||
|
|
|||||||
It is doing just waht it is supposed to cuz the @WKSTA is the TS. There is at least one FAQ on the topic and a few hundred posts. |
||||||||
|
|
|||||||
Can you be more helpful .... I am new on this forum. I haven't seen anything on this dealing with citrix. |
||||||||
|
|
|||||||
I think Les is referring to this FAQ . See the second post in the FAQ. |
||||||||
|
|
|||||||
Thanks I found what I needed %CLIENTNAME% THANKS! |
||||||||
|
|
|||||||
Hi Guys, The %CLIENTNAME% Doesn't appear to work when I'm loggin in. I can run it after I am logged in and I seems to work fine but I need to use it in a login script. I even used a bunch of sleep commands. Still a no go. Any help would be appreciated! thanks! Faithful |
||||||||
|
|
|||||||
%CLIENTNAME% is available for NT or better systems. Maybe you will want to use @wksta for your W9x systems? Kent |
||||||||
|
|
|||||||
kent he is talking about Citrix client logon's |
||||||||
|
|
|||||||
ummm.... I need something that is backwards compatible all the way from Windows 95 ... connecting into a Citrix session. But The fact still is .... If I am fully logged in and run the script it works ... but having this script as my login script it doesn't get the %CLIENTNAME% HELP!! |
||||||||
|
|
|||||||
Can you provide a little of your script, specifically where the error is occuring? |
||||||||
|
|
|||||||
Is this a network GPO script, a local GPO script, a legacy logon script, or a Citrix usrlogon.cmd script? Does the script run sync or async? |
||||||||
|
|
|||||||
This is a windows login script ... I'm not sure what the technical wording is nor do I know about the sync or async. But you go into group policies to tell it to run this script as a login script. Here is a snippet: look for %CLIENTNAME% Code:
|
||||||||
|
|
|||||||
Sorry guys .... my post was above ... I forgot to login. |
||||||||
|
|
|||||||
Use EXPANDENVIRONMENTVARS() to expand the environment variable before feeding it into the SQL statement and see also the DBCommand() UDF. |
||||||||
|
|
|||||||
You might try this to see what values you get. Code:
|
||||||||
|
|
|||||||
Allen, ... I tried your script and it was a no go ... Is there something I need to do with this first? EXPANDENVIRONMENTVARS() Sealeopard do I just do something like this: EXPANDENVIRONMENTVARS(%CLIENTNAME%) ?? Help! |
||||||||
|
|
|||||||
Quote: Can you be more specific? What didn't work? What was the output? The script needs to be run on the Terminal Server in order for the CLIENTNAME var to exist. |
||||||||
|
|
|||||||
I just didn't show anything where the %CLIENTNAME% should of been. It doesn't seem to be getting that value my my computer. Any other ideas?? |
||||||||
|
|
|||||||
Try running this on the Citrix/Terminal Server... I don't think you will get a value if you run it locally on your pc. |
||||||||
|
|
|||||||
I am running it on the Citrix Terminal Server ... I login and the login.bat runs ... which is running login.kix script. Maps some network drives and tries to query the database. No values for %CLIENTNAME% though. Help! |
||||||||
|
|
|||||||
At this point, I doubt the variable is defined at all, which may be where Les was headed with Sync/Asych issue... One last test just to see: Code:
|
||||||||
|
|
|||||||
I think you may be right .... with that last snippet of code it returns: Var does not exist So, now what do I do. ? Thanks for your help |
||||||||
|
|
|||||||
EXPANDENVIRONMENTVARS is explained in the KiXtart Manual. I suggest reading it as it also explains how to debug a script. |
||||||||
|
|
|||||||
So are we saying that the previous posts of code ... use of EXPANDENVIRONMENTVARS ... were done incorrectly?? Because all of the above examples didn't return any value for %CLIENTNAME%. |
||||||||
|
|
|||||||
The above message was mine. Forgot to login. Sorry. |
||||||||
|
|
|||||||
Does anyone have a moment to help out? |
||||||||
|
|
|||||||
Have you opened a DOS window on your Terminal server/Citrix desktop and typed "set" <enter> to see if that environment variable is there to use? |
||||||||
|
|
|||||||
I have tested this with a network GPO and the enviro var is not present at the moment the script runs. It is however there after logon if the same script is manually run from the desktop. I think you have no recourse but to put it into a different script run at a later time in the logon sequence. You could try putting it in the 'C:\WINNT\system32\usrlogon.cmd' script or push a link to the RunOnce reg key. |
||||||||
|
|
|||||||
Thank you Les for all your hard work. I really could use this in the Login script. Does anyone know how to push this variable into the initial login script?? Thanks, Faithful |
||||||||
|
|
|||||||
I've been thinking ..... Maybe that would work. How could I tell the first Kix script to run a second script? Thanks, Faithful |
||||||||
|
|
|||||||
Check out CALL.. For example - CALL @SCRIPTDIR+'\yourscript.kix' HTH, Kent |
||||||||
|
|
|||||||
just Googleing... not sure if this will help or not, but do you have a system variable called WINSTATIONNAME? |
||||||||
|
|
|||||||
I take it you are still in denial. I doubt that there is anything that you can do to have that env var populated that early in the logon. Have you given thought to my two suggestions? |
||||||||
|
|
|||||||
Jeepers... leave my laptop for a minute and three other posts sneak in there. CALLing another script is no good cuz the var just isn't there. YOu could push a link to the RunOnce key cuz that is the last thing processed in the logon sequence. I just had another thought... give one of the helper apps I mention in the FAQ a go. Warren Simondson's ClientInfo should be able to pull what you need since it does not rely on the env var. |
||||||||
|
|
|||||||
Well you may be able to just sleep the script for a while if needed. Since Les has experience in this area perhaps he can answer that question. If so, just place a sleep command in your script to wait for this to become available and then it will continue after the sleep. |
||||||||
|
|
|||||||
DOC, Think about it for a second. KiX inherits whatever is in the env at the time it is invoked. SLEEPing for a million years won't change was isn't there. |
||||||||
|
|
|||||||
Another solution is to use the CTXCINFO.EXE program I cobbled together some time ago to return client information, or Howard Bullocks helper DLLs. The former definately returns the client name, and I suspect the latter does too. The site that used to host ctxcinfo.exe is no longer available, so if you want it let me know and I will post it to you. It was originally documented here Information on Howards DLL can be found in the Citrix/Terminal Server FAQ. |
||||||||
|
|
|||||||
or http://www.kixhelp.com/downloads.htm |
||||||||
|
|
|||||||
Hi All, Thanks for all your input, I do appreciate it. I tried calling the second script from the first and Les you were right I got the same result. Anyway, I need help than ... how would I do this: Quote: If I did the RegOnce thingy ... how is this accomplished. Let me know. Thanks, Faithful |
||||||||
|
|
|||||||
You could try http://home.comcast.net/~habullock/Perlutilities.htm ClientData.exe and WshPipe UDF to get your information from the user's logon script if were to be execute in a Citrix/terminal server session. |
||||||||
|
|
|||||||
Les when you get a chance could you explain your example. I prefer not to use an executable. I would just like to be able to run a simple kix script. Thanks |
||||||||
|
|
|||||||
Maybe saomething like this untested Code: $RC = WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce","KiXScript","\\server\share\wkix32.exe \\server\share\script.kix","REG_SZ") |
||||||||
|
|
|||||||
My buddy here (named Steve) just tried querying %CLIENTNAME% in an async login script, logging into terminal services, and was able to see %CLIENTNAME% resolve ok - fyi ! |
||||||||
|
|
|||||||
Can we change the script from SYNC to ASYNC?? Les, I tried your example ... and it works but you have to login once and then log off ... then log on again. Can I just make it so it works the first time and then from there on?? Thanks, Faithful |
||||||||
|
|
|||||||
My buddy here just tried it using SYNC, and it still worked great - he's running Windows 2003 Terminal Services btw - fwiw idk. |
||||||||
|
|
|||||||
Steve's script was just simply: echo %CLIENTNAME% pause |
||||||||
|
|
|||||||
Well that isn't working for whatever reason Shawn. Anyway, I just found out I have another Delima .... We are Using NFUSE ... does anyone here use this program? So, this kix script instead of showing the clientname... (which it does cause we are telling it to run as a seperate script in the Registry RunOnce) But In NFUSE the CLIENTNAME variable is changed to DOMAIN\username OY!!! Anyone worked around NFUSE before? (BTW - ours our running Win2K ... and logging in through Citrix) |
||||||||
|
|
|||||||
Are they only being offered the application, or are they offered the full desktop. |
||||||||
|
|
|||||||
To answer your lastest question... this may help... Source Quote: And here is something that may apply to you as well: Source Quote: |
||||||||
|
|
|||||||
Quote: You could hand-job it into HKLM\...\Run instead of scripting it into HKCU\...\RunOnce. |
||||||||
|
|
|||||||
Hi all, I have taken this login script out of the login policy but apparently the script still shows up in the registry and hasn't left. Any idea as to why it doesn't go away? |
||||||||
|
|
|||||||
Is the computer name stored in the registry somewhere in Win9x? I know in XP you have a few references, one of which being the distinguished name, which could be stripped down to the simple computer name. Here's another example... Quote: ???? |