How automatic set the background picture in Cognos controller for all clients on a Citrix server?

Product:
Cognos Controller 10.1
Microsoft Windows 2008 server

Issue:
How automatic set the background picture in Cognos controller for all clients on a Citrix server?

Inside Cognos Controller client, you can define a BMP file to be used as background picture.
Recommended is to have a different background picture for your test environment.
To make Controller Client color different from the productions clients.

In Cognos Controller client go to
Maintain – Installation – Local Preferences
Here you can enter the key app_background
And a value that points to a local BMP file.

Problem:
Local Preferences values are stored in the ccr.config file for each user in there windows profile.
You need to populate this file for each user when they logon to the Terminal Server.


Solution:

On citrix server create a folder called d:\script
On citrix server create a BMP file and save it as c:\windows\background.bmp
On citrix server download AUTOIT3:EXE from http://www.autoitscript.com/site/autoit/downloads/
And place it in folder d:\script

Create a text file in folder d:\script named replaceccr.au3 with this content:

$TextFileName = @UserProfileDir & "\AppData\Roaming\Cognos\ccr\ccr.config"

$FindText = "</profile>"
$ReplaceText = ' <LocalPref> <add key="app_background" value="c:\windows\background.bmp" /> </LocalPref> </profile> '

$FileContents = FileRead($TextFileName)
$Check = StringInStr( $FileContents, "</LocalPref>" )

if $Check = 0 Then

$FileContents = StringReplace($FileContents,$FindText,$ReplaceText)
FileDelete($TextFileName)
FileWrite($TextFileName,$FileContents)

EndIf

Create a text file in folder d:\script named updateccr.cmd with this content:
d:\script\autoit3.exe d:\script
eplaceccr.au3

In folder d:\script these files should now be:
Autoit3.exe = used to process au3 script files
Replaceccr.au3 = will check the users ccr.config file and add the “app_background” if it does not already have a “LocalPref” value.
Updateccr.cmd = file to run to active the script

You may then add the updateccr.cmd file to your C:\Windows\System32\usrlogon.cmd, to make it run when anyone logon to the Windows Server.

More information about Terminal Server logon script
http://support.microsoft.com/kb/195461

http://www.brianmadden.com/blogs/guestbloggers/archive/2005/03/01/understanding-the-citrix-metaframe-logon-and-logoff-process.aspx

More information about Autoit3:

http://www.autoitscript.com/autoit3/docs/functions.htm
http://www.autoitscript.com/autoit3/docs/macros.htm

www.cogknowhow.com