windows scriopting?

dctmfoo

Junior Member
Jun 19, 2008
2
0
0
All,



I need to write a script which will be kicked off by AD login script to perform the following stuff.

1) Check if Citrix Client 9.0 is installed or not. If its installed go to step 2 and if its not installed, install citrix client 9.0. (You can check if its in add/remove programs or you can check if appsrv.ini exists in C:\Program Files\Citrix\ICA Client or not)

I will make a MSI package to install the citrix client. The script only has to initiate the install.


2) Check appsrv.ini for


SSOnUserSetting=On

EnableSSOnThruICAFile=On


If it?s off, make it on. If it doest exist append it.


3) import the following values to the registry



[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PnSson]
"Type"=dword:00000004
"IsEnabled"=dword:00000001



[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PnSson\NetworkProvider]
"ProviderPath"="C:\\Program Files\\Citrix\\ICA Client\\pnsson.dll"
"Class"=dword:00000002
"Name"="Citrix Single Sign-on"



[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PnSson\Enum]
"0"="Root\\LEGACY_PNSSON\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001


we can just put this stuff in a .reg file and make the script execute it.


4) Go to the following registry location and make sure that the value PnSson is included in the comma separated list. Sometimes the value is there, other times not. The other values will likely be different as well, so just see if it is there or add it to the end.


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order]
"ProviderOrder"="RDPNP,LanmanWorkstation,WebClient,PnSson"



The purpose of this is to allow single sign on effective in citrix web client. This could be vb script or any other windows scripting lang.



Thanks for your help.
 

tfinch2

Lifer
Feb 3, 2004
22,114
1
0
This is probably not what you are looking for and a bit unrelated, but it is bad practice to hard code an absolute path to find if something is installed or not. What if someone installs Citrix in a place other than C:\Program Files\Citrix\ICA Client?
 

dctmfoo

Junior Member
Jun 19, 2008
2
0
0
I know its a very bad idea to hardcode values like this but we are going to v10 pretty soon and this script will be retired. As of now we know that when we pushed out citrix client for everyone in the company we installed it on the path in my OP so that wont be a problem.

Alternatively the script could just search for the certain ini and dll files in the root drive and that will be enough to determine if citrix is installed or not.
 

Cogman

Lifer
Sep 19, 2000
10,286
147
106
Shouldn't be too hard. Easiest method would be to try and open a file for reading, if it opens then it must exist, if not then it does. The best method would be to check for the presence of a registry key. (really, thats not too hard either).

It could be done simply in C++ with the windows header, you'll have to look up the commands yourself though. (We are talking like 3-4 lines of code).

Im not going to write the script for you, too trivial (maybe I will if I get bored) but RegOpenKeyEx, RegQueryValueEx, and RegCloseKey are your friends.