Page 1 of 3 123>
Topic Options
#134501 - 2005-02-24 08:12 PM @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
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

Top
#134502 - 2005-02-24 08:44 PM Re: @wksta
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#134503 - 2005-02-24 09:37 PM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
Can you be more helpful .... I am new on this forum.
I haven't seen anything on this dealing with citrix.

Top
#134504 - 2005-02-24 09:44 PM Re: @wksta
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
I think Les is referring to this FAQ . See the second post in the FAQ.

Edited by Allen (2005-02-24 09:45 PM)

Top
#134505 - 2005-02-24 09:54 PM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
Thanks I found what I needed

%CLIENTNAME%

THANKS!

Top
#134506 - 2005-03-01 12:35 AM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
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

Top
#134507 - 2005-03-01 12:40 AM Re: @wksta
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
%CLIENTNAME% is available for NT or better systems. Maybe you will want to use @wksta for your W9x systems?

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#134508 - 2005-03-01 01:03 AM Re: @wksta
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
kent he is talking about Citrix client logon's
Top
#134509 - 2005-03-01 01:05 AM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
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!!

Top
#134510 - 2005-03-01 01:47 AM Re: @wksta
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Can you provide a little of your script, specifically where the error is occuring?


Top
#134511 - 2005-03-01 02:13 AM Re: @wksta
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
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?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#134512 - 2005-03-01 05:25 PM Re: @wksta
Anonymous
Unregistered


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:

$connection = createobject("adodb.connection")

$ConnDSN = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=172.16.1.183;DATABASE=ncives;USER=webadmin;PASSWORD=webadmin;";OPTION=3;"

$= $connection.open($connDSN)

? @SERROR


$rs = $connection.execute("SELECT workst.wSid FROM workst WHERE workst.pcName = '" + %CLIENTNAME% + "'")

? @SERROR


Top
#134513 - 2005-03-01 07:12 PM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
Sorry guys .... my post was above ... I forgot to login.
Top
#134514 - 2005-03-02 12:11 AM Re: @wksta
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Use EXPANDENVIRONMENTVARS() to expand the environment variable before feeding it into the SQL statement and see also the DBCommand() UDF.
_________________________
There are two types of vessels, submarines and targets.

Top
#134515 - 2005-03-02 12:16 AM Re: @wksta
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
You might try this to see what values you get.

Code:
 

break on
? "Test 1: %clientname%"

? "Test 2: "
$clientname=CreateObject("WScript.Shell").ExpandEnvironmentStrings("%CLIENTNAME%")
$clientname

? "Test 3: "
$clientname=EXPANDENVIRONMENTVARS("%clientname%")
$clientname

? "Test 4: "
$output=wshpipe('%comspec% /c set clientname',1)
for each $line in $output
split($line,"=")[1]
next

Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If Not VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If Not $NoEcho $Output Endif
$WshPipe=Split(Join(Split($Output,CHR(13)),''),CHR(10))
Exit($oExec.ExitCode)
EndFunction


Top
#134516 - 2005-03-02 12:42 AM Re: @wksta
Anonymous
Unregistered


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!

Top
#134517 - 2005-03-02 12:44 AM Re: @wksta
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Quote:


I tried your script and it was a no go





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.



Edited by Allen (2005-03-02 12:47 AM)

Top
#134518 - 2005-03-02 12:46 AM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
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??
Top
#134519 - 2005-03-02 12:50 AM Re: @wksta
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
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.
Top
#134520 - 2005-03-02 12:59 AM Re: @wksta
Faithfulman Offline
Getting the hang of it

Registered: 2005-02-22
Posts: 68
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!

Top
Page 1 of 3 123>


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

Who's Online
0 registered and 718 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.073 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

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