Page 3 of 5 <12345>
Topic Options
#202414 - 2011-06-06 11:40 AM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
What is in the $xen variable? I do not see it being filed before it is referenced. If it is not filled the Else section will always be true.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202415 - 2011-06-06 12:01 PM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
what do you mean?
i've used the code as it is.

Top
#202416 - 2011-06-06 01:32 PM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Your script checks if $xen holds anything. If it is empty this check will fail and the Else statement will be executed. You need to put something in it to get a successful check. If you just do an If $xen check and $xen is null (as in empty) the check will never be true and the following lines will not be executed. It will skip to the Else statement if there is an Else statement.
I do not have a xen server to test with but it should be possible to see that the client in on a xen server and executed whatever is needed for xen sessions.

If you start a xen session and check all environment variables from the command line there might be one or more that can be used to determine if it is a xen session or not. Another option can be to check if one or more specific xen server files exist or if the hostname is your xen server. Once this is done you can get the client name and connect the printers they need and do all other stuff that needs to be done for the people.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202417 - 2011-06-06 01:53 PM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
?

the session name is on both "console". If it was different then we didn't need the xdclientname right?

Top
#202418 - 2011-06-06 03:17 PM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Like I said I do not have a xen server for testing so I did not know that.

A method to identify the xen server should be implemented and the results of this check should be put in the $xen variable. Without this the script Shane posted and you tested is not going to work.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202419 - 2011-06-06 03:44 PM Re: how to read a custom environment variable (XDClientName) [Re: Glenn Barnas]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
hi,

did you find something hoe to solve this?

thanks

Top
#202425 - 2011-06-06 05:35 PM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
I'm amazed that someone with so little knowledge of scripting, has been put in charge of script maintenance. Nevertheless, to get it to work without that error popping up there has to be someway to differentiate server from client. Are all of your servers named with a similar convention? Are they all on a separate IP range? Are they all connected over ICA so we can use sessiontype()? It is hard for us to be of more assistance when you are the only one with the Xen servers to test on.
Top
#202427 - 2011-06-06 06:16 PM Re: how to read a custom environment variable (XDClientName) [Re: ShaneEP]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
huh! wtf?! none of your sugestions work. you call youself "citrixman" we've got here 3 pages without a working solution, but it seems you know the answer. but won't tell it?
If it was that easy i wouldn't ask for it nor we have 3 pages needed.........1 reply was enough. but apperently it isn't that simple.

The work of Glenn is super.

Top
#202428 - 2011-06-06 06:58 PM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2127
Loc: Tulsa, OK
Well then use Glenn's work. He's a kix master for sure and nobody said his work isn't super. If you want that error message to pop every time it runs on a p.c. then go for it dude. All of my solutions are perfectly acceptable with just a bit of testing and correct implementation. The real problem is that you don't even know how to understand a simple If Endif statement in Kix...Resulting in 3 pages of you being confused by possible legitimate solutions.

"Can someone make it complete?", "i'm confused now.", "how to solve this?", "any idea?", "now i'm lost", "anyone a solution, i'm desperate:(", "what do you mean?".

And yes I created this account about 9 years ago (about how long i've been using kix as well) when I was a full time citrix server administrator. We are just volunteers on here trying to help people that need it. You come on here expecting to not have to do anything but buy somebody an imaginary beer and be spoon fed a complete solution to your problem. And if we knew your environment better, you may possibly have gotten one (were that nice). But we don't...So in conclusion...Go read some documentation! I have nothing more to say in this thread. But with all sincerity...Good luck!

Top
#202429 - 2011-06-06 09:00 PM Re: how to read a custom environment variable (XDClientName) [Re: ShaneEP]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I'm sorry to say it but you’re right Shane.

Several solutions were offered but offering a 100% working solution is impossible without knowing the setup. Trying an offered solution which is a suggestion and is never offered as complete and working bullet proof code is great but some understanding of kixtart is required. Just copy and paste and then saying that it doesn't work is not the way to go.

All the members that replied have been more than fair and offered several solutions but are unable to give a fully working script because we do not know the full setup. I’ve been using kixtart since 1999 and did not find anything that could not be done with kixtart and possibly the help of one or two external DLL’s or applications. I'm sure there must be a way to check if the person is on a xen server and get the name of the client the person is using but not like this. Like said we are all volunteers and do this besides our regular job. Attacking someone on the nickname they use on this board or on the fact that they did not supply fully working code without knowing the complete setup is an insult and is just weak and unprofessional.

I’m willing to work (and I don’t think I’m the only one) on a solution but I need cooperation and not just “It doesn’t work what now?” otherwise I think my efforts are useless.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202430 - 2011-06-06 10:27 PM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
about info? maybe you've missed post 1 and 16. (no offence)

i'm not attacking anyone.

i don't know hot to figure out how to sepparate the physical client from the virtual one, neither do you....it seems.

theer is no different session type.
the physical client is locked down with the citrix lockdown tool, so the physical client are presenting the virtual desktop logon screen.

it's possivle with the citrix session printers but this doesn't work always smooth. adn it's not very clear and messy. so i like kix way better.

yes maybe i'm stupid........i admit, but that doesn't mean i can't ask for specific help.

this is a decent forum, so don't say crap like..........just google. that is what a lot of people yells at forums....that's the easyest way.

right:)

Top
#202431 - 2011-06-06 11:15 PM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I did read each and every post in this thread but some info that can be helpful is not in any of them. You are right I do not know xen but I’m just trying to help to get things up and running for you. Nobody told you to Google and nobody called you stupid. Maybe you are just not that experienced in kix scripting. That’s how we all started. Sure you can ask for specific help. Someone may have an answer.

Ok. Let’s get going.
Facts:
  • Clients are locked down and immediately show the virtual desktop logon screen.
  • There is more than one xen server.
  • First six characters of the client name are unique to a specific location.
  • Printers should be set based on the client’s location.

Questions:
  • Do your xen servers have a specific naming layout that can be used to identify them (xenserver01, 02, etc...) or something like it? Maybe they are in a specific IP range or is there anything else specific to the xen servers that can be used to identify them in kix?
  • Is the clientname environment variable available in the virtual desktop session? If so then it might be useful to identify the client and set printers based on the client name. You can use the xd4clientname application but if it is available as an environment var then this is much easier.

Below is an example of what I'm after. It assumes that the name of the servers can be used to identify them but this can be changed if needed. It is pseudo code just to give you an idea. It is not a working script ;\)
 Code:
If InStr(@WKSTA, "XENSERVER")
	Shell @LDRIVE + "\XD4Clientname.exe"	
	$clientname = ExpandEnvironmentVars(%XDClientName%)
	Select
		Case Left($clientname, 6) = "LA-MAN"
			;add printer code for LA-MAN clients here.
		Case Left($clientname, 6) = "CA-DOC"
			;add printer code for CA-DOC clients here.
	EndSelect
Else
	?"Not on a xen server"
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202432 - 2011-06-07 12:06 AM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Mart,

Just to clarify, the XD4ClientName.exe can't be run from within Kix.. it sets an environment var that exists only within the subshell. It really must be called before running Kix to work. Calling it from WSHPipe might work, but it really would work best if WSHPipe called a bat file that called the EXE and then echo'd the environment var, so that WSHPipe only captured the variable data.

That said... one of the quickest ways to ostracize oneself is to expect complete answers to problems. Mart, Shane, and I have all posted examples based on what we know (in general about Citrix/Xen and specifically about what has been described. We all have an expectation that when someone asks for assistance, they will take the responses and try a few things, attempt some of the examples, and report back specific conditions.

The example that I posted will work, but requires you figure out how to define the batch file such that the XD4ClientName.exe runs only when logging onto a Xen server. Mart's Kix code won't work because the way the exe works, but his IDEAS ARE SPOT ON! His questions are valid! You need to try a few things on your own, in your specific environment. Something as simple as
 Code:
IF ^%COMPUTERNAME%^==^someXENserver^ xd4ClientName.exe
- with one IF for each Xen server, then the command will run only if logging into a Xen server. Try it, let us know if it worked. If it doesn't, report the error messages, not just that it didn't work.

Bottom line, it's your problem in your environment, you'll need to get your hands dirty - more so that the rest of us, simply because you're there.

We're all here because we're willing to help. Most times, that help is in the form of sharing ideas. There's the occasional "silver platter" code, and if you figure this out, I'd be happy to post the result in the code vault to help the next person struggling with this.

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

Top
#202433 - 2011-06-07 01:18 PM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
 Originally Posted By: Mart

Questions:
  • Do your xen servers have a specific naming layout that can be used to identify them (xenserver01, 02, etc...) or something like it? Maybe they are in a specific IP range or is there anything else specific to the xen servers that can be used to identify them in kix?
  • Is the clientname environment variable available in the virtual desktop session? If so then it might be useful to identify the client and set printers based on the client name. You can use the xd4clientname application but if it is available as an environment var then this is much easier.



we have a Provisioning server named(computername): va-ctx-prs1
and a presentation server named(computername): va-ctx-ddc1
virtual clients have the computername: va-ctx-001 ~ 200

without running xdclient the clientname environment variable is not available, when running xdclient(with error popup) the xdclient variable is present.

thanks

Top
#202434 - 2011-06-08 09:32 AM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
A bit late but I was unable to reply yesterday afternoon.

The code below should do the trick. It assumes that the xd4cleintname application has already run from your batch file so the xdcleintname environment variable is filled with the client name.
It checks if the server name contains VA-CTX-DDC and sets the $xen variable to Yes or No. As far as I understand this is the only server clients connect to. It leaves out the 1 at the end to provide some flexibility when adding another server. If $xen is yes it gets the client name from the xdclientmane environment variable and checks the first 6 characters. If they match whatever you specify (the aaaaaa, bbbbbb, cccccc strings) it executes the code placed below the check. If $xen is anything else but Yes it can execute some other code if needed. This is an example to show the concept. The client name check needs to be modified to match the client names you use.

 Code:
If InStr(@WKSTA, "va-ctx-ddc")
	$xen = "Yes"
Else
	$xen = "No"
EndIf

If $xen = "Yes"
	$clientname = ExpandEnvironmentVars(%XDClientName%)
	Select
		Case Left($clientname, 6) = "aaaaaa"
			;Add code for aaaaaa systems here.
		Case Left($clientname, 6) = "bbbbbb"
			;Add code for bbbbbb systems here.
		Case Left($clientname, 6) = "cccccc"
			;Add code for cccccc systems here.
	EndSelect
Else
	;Place code for non xen sessions here if needed.
	;You can remove the Else section if nothing is needed for non xen sessions.
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202435 - 2011-06-08 09:45 AM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
 Originally Posted By: arjanv
huh! wtf?! none of your sugestions work. you call youself "citrixman"


Well I must say that your response is way out of line and I'm not going to be as nice as the other members here.

Please refrain from any more such out bursts or I will ban your account. People are here to help others and have a good time, not take abusive replies from others.

Just because this is the Internet does not give one the right to respond like that. You certainly would not do that in a room with men you'd never met before without taking the chance of a physical confrontation.

So let's please just drop any attitude and move on.

Thank you.

Top
#202436 - 2011-06-08 09:49 AM Re: how to read a custom environment variable (XDClientName) [Re: Glenn Barnas]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
I'll try this tomorrow, but i doubt if this will work, because users don't logon to a xen server. all users logged on to the same domaincontroller, or do i missing something here.

somehow i need xdclient to run when the (virtual)client computername begins with the VA-CTX and the load the kix script.

ps. does a loginscript loads earlier than a gpo logonscript? or doesn't that matter?

maybe a crappy solution, but also could try to load the script on the virtual client inself from example the "startup" folder.

Top
#202437 - 2011-06-08 09:56 AM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
arjanv Offline
Fresh Scripter

Registered: 2010-03-11
Posts: 49
Loc: netherlands
Thanks, looks promissing, i'll going to test this also tomorrow.

as an reply on NTDOC. my apologise, i'm deeply sorry, at first i found the citrixmans response also not nice.

Top
#202438 - 2011-06-08 11:41 AM Re: how to read a custom environment variable (XDClientName) [Re: arjanv]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Great, let us know the outcome please.

In the batch file you could use %computername% to see if it is a xen server or not just like @wksta in kix it returns the name of the system. You can then start the xd4clientname app if it is a xen server or skip it if it is a regular system.

AD settings or the GPO version are both logon scripts so imho they should run at the same stage during the logon process.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#202439 - 2011-06-08 10:11 PM Re: how to read a custom environment variable (XDClientName) [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
Maybe thinking too simple here but:
 Code:
If Left(@WKSTA,6) = "VA-CTX" AND CInt(Right(@WKSTA,3)) < 1000
  ;Do Stuff
EndIf

Top
Page 3 of 5 <12345>


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

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.189 seconds in which 0.147 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