Reading environment variables using VBScript or ActiveX on Citrix client
I'm having troubles while accessing environment variables in an html page. I need to run a web 开发者_开发问答application (php) on a Citrix server distribution. What I tried to do is the following VBScript code on my html body:
Set oShell = CreateObject( "WScript.Shell" )
comp=oShell.ExpandEnvironmentStrings("%CLIENTNAME%")
It works as long as I login with my admin account (because of the IE running script permissions), but when I enter with the normal user account it doesn't work saying it can't create the object. The sad thing is that it's not possible to change the normal user profile.
Does someone knows another way to get them? It's possible to install new software on the machine, but it should be called from a htlm website. So I'm thinking if could be possible to create some kind of ActiveX or java applet to read those environment variables, but as I'm new on ActiveX/Applets I dont know If I'll need some kind of special setup for those permissions.
Any help will be more than welcome! :)
Probably the simplest way would be to have your app accept a string in the URL with the client name, then have Citrix pass this in when the app is launched (using the %clientname%
variable).
I use this vbscript all of the time via Citrix to return the %clientname% when running the app from citrix additionally I added to identify it should the app be running locally as well.
Dim sh
Dim en
noWorkstation = "No Workstation"
Set sh = CreateObject("WScript.Shell")
Set en = sh.Environment("VOLATILE")
en("Citrix_Variable") = sh.ExpandEnvironmentStrings("%CLIENTNAME%")
sTemp = sh.ExpandEnvironmentStrings("%CLIENTNAME%")
set WshNetwork = CreateObject("Wscript.Network")
computername = wshNetwork.Computername
msgbox "Computer name is" computername "...And should be empty because we are looking for CLIENTNAME"
msgbox "CLIENTNAME is..." clientname
'Or if you can return the correct answer via Citrix or locally connected app
if sTemp = "%CLIENTNAME%" then
clientname = computername
end if
精彩评论