How do we configure our Citrix Clients especially when we have Ghosted (or imaged) our machines?
code:
 ;Citrix Configuration
;Kent Dyer
;Ref. http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=10&t=000020
;Version 1.3 08 April 2003
; Cleaned up code, was based on Citrix Client 4.x
;Version 1.2 18 August 2001
;Version 1.1 17 August 2001
;Version 1.0 Originally coded on 14 August 2001
;This sets up and pre-configs users logging into Citrix
;Does the following - Checks PN.INI, and APPSRV.INI
;Feedback and comments welcome to dyerkb@myrealbox.com
;
;**** PLEASE MAKE THE FOLLOWING CHANGES BELOW TO REFLECT YOUR ENVIRONMENT ****
;(1) Change: YOUR Farm to be your farm
;(2) Change: aa.bb.cc.dd to be your tcpaddress
;(3) Change: icahttpbrowseraddress to be ica.YOURDOMAIN.COM
;(4) Change: wwxxyyzz be your Farm's Code
;You should be able to CALL this as a Separate File or place in your current script.
;Currently written for NT/2K..
;**** END OF NEEDED CHANGES ****
;**** DEVELOPER'S NOTES ****
;Added in code to check for and/or update WFCNAME.INI 17 August 2001
;we were doing it in a separate script - Sorry Guys! - Version 1.1
;Added in code to check for 9x vs. NT/2k 18 August 2001 - Version 1.2
;**** END OF DEVELOPER'S NOTES ****
;**** THANKS AND RECOGNITION ****
;Thanks to MCA and his KIXSTRIP UTILITY! Visit his site at - http://home.wanadoo.nl/scripting/

CLS
BREAK ON
$farmname = 'YOUR Farm'
$tcpaddress = 'aa.bb.cc.dd'
$icahttpbrowseraddress = 'ica.YOURDOMAIN.COM'
$citr=READVALUE('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WFCMGR32.EXE','')
$appdata=READVALUE('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders','AppData')
$citrv=GETFILEVERSION($citr)
IF $citr<>''
IF $citrv<6
IF 1=@inwin ;is it winnt or 2K?
$wfcfile='%SystemDrive%\WFCNAME.INI'
ELSE
$wfcfile='C:\WFCNAME.INI'
ENDIF
ENDIF
IF @wksta<>READPROFILESTRING($wfcfile,'WFClient','ClientName')
$rc=WRITEPROFILESTRING($wfcfile,'WFClient','ClientName',@wksta)
ENDIF

IF @wksta<>READVALUE('HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client','ClientName')
$rc=WRITEVALUE('HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client','ClientName',@wksta,'REG_SZ')
ENDIF

$pn=$appdata+'\ICAClient\pn.ini'

IF 0=Exist($pn) ; Create the PN.INI and APPSRV.INI files
$rc=WRITEPROFILESTRING($pn,'Program Neighborhood',$farmname,'6ej2isep')
$rc=WRITEPROFILESTRING($pn,$farmname,'TransportDriver','TCP/IP')
$rc=WRITEPROFILESTRING($pn,$farmname,'DesiredHRES','4294967295')
$rc=WRITEPROFILESTRING($pn,$farmname,'DesiredVRES','4294967295')
$rc=WRITEPROFILESTRING($pn,$farmname,'ICASOCKSProtocolVersion','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'ICASOCKSProxyPortNumber','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'ICASOCKSTimeout','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'PNName',$farmname)
$rc=WRITEPROFILESTRING($pn,$farmname,'ConnectType','1')
$rc=WRITEPROFILESTRING($pn,$farmname,'UseAlternateAddress','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'NoAutoDetectProtocol','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'PNProtocolMask','1')
$rc=WRITEPROFILESTRING($pn,$farmname,'Compress','On')
$rc=WRITEPROFILESTRING($pn,$farmname,'PersistentCacheEnabled','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'MouseTimer','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'KeyboardTimer','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'AudioBandwidthLimit','-1')
$rc=WRITEPROFILESTRING($pn,$farmname,'NoDeskInt','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'PNCacheRefresh','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'DefaultVideoType','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'UseDefaultSound','On')
$rc=WRITEPROFILESTRING($pn,$farmname,'DefaultSoundType','1')
$rc=WRITEPROFILESTRING($pn,$farmname,'ClientAudio','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'UseDefaultEncryption','On')
$rc=WRITEPROFILESTRING($pn,$farmname,'EncryptionLevelSession','1')
$rc=WRITEPROFILESTRING($pn,$farmname,'UseDefaultWinColor','On')
$rc=WRITEPROFILESTRING($pn,$farmname,'DesiredColor','4')
$rc=WRITEPROFILESTRING($pn,$farmname,'UseDefaultWinSize','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'DesiredWinType','8')
$rc=WRITEPROFILESTRING($pn,$farmname,'TWIMode','On')
$rc=WRITEPROFILESTRING($pn,$farmname,'ZLKeyboardMode','0')
$rc=WRITEPROFILESTRING($pn,$farmname,'ZLMouseMode','2')
$rc=WRITEPROFILESTRING($pn,$farmname,'SavePNPassword','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'NoSavePwordOption','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'UseLocalUserAndPassword','Off')
$rc=WRITEPROFILESTRING($pn,$farmname,'TcpBrowserAddress',$tcpaddress)
$rc=WRITEPROFILESTRING($pn,$farmname,'BrowserProtocol','UDP')
$rc=WRITEPROFILESTRING($pn,$farmname,'Username',@userid)
$rc=WRITEPROFILESTRING($pn,$farmname,'Domain',@ldomain)

$appsr=$appdata+'\ICAClient\APPSRV.INI'
$rc=WRITEPROFILESTRING($appsr,'WFClient','ICAHttpBrowserAddress',$icahttpbrowseraddress)
$rc=WRITEPROFILESTRING($appsr,'WFClient','PNDefault',$farmname)
RETURN
ENDIF
ELSE
RETURN
ENDIF



[ 08. April 2003, 22:50: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's