About Terminal Server, Citrix, Delphi and other stuff
12 Jun
Today someone asked questions about a script I wrote back in 2007 to solve a bug in Outlook (2003 but at least Outlook XP has the same issue). If you have access to someone’s calendar and want to make a print of it Outlook wants to print it in it’s default view which is a combined view on calendar appointments and tasks. However if you do not have permissions to the other persons tasks folder Outlook refuses to print and displays the following error: The messaging interface has returned an unknown error. If the problem persists, restart Outlook.
To resolve it you can go to the Calendar | Daily View | Print, then click Page Setup and under Include Options deselect Taskpad. I didn’t want to do this for all users that’s why I wrote the script.
23 Jun
I was working on an unattended installation of Citrix Presentation Server 4.5 or rather Citrix Xenapp. I was creating the dsn file for the installation by a script that uses the echo command and output this to a file.
This is a part of the script:
rem Create ODBC file
rem ———————————————————————–
echo [ODBC] > %ODBC%
echo DRIVER=SQL SERVER >> %ODBC%
echo UID=%SQL_SA% >> %ODBC%
echo Address=%SQL_SERVER%,1433 >> %ODBC%
echo Network=DBMSSOCN >> %ODBC%
echo LANGUAGE=us_english >> %ODBC%
echo DATABASE=%CTX_DATASTORENAME% >> %ODBC%
rem echo WSID=%COMPUTERNAME% >> %ODBC%
echo APP=Citrix IMA >> %ODBC%
echo SERVER=%SQL_SERVER% >> %ODBC%
echo Description=Citrix Datastore >> %ODBC%
echo. >> %ODBC%
Even though the generated DSN file looks ok the installation fails. If you look in the installation log you can see this error: Error 26009. Could not Access the datastore using the DSN file.
I then created a dsn file through the ODBC Data Source Administrator and then the installation went ok. I compared the DSN file with the one my script generated and it was the same.
A search with Google and in the Citrix forums leads to numerous posts with the same error but none with a real solution. Some suggestions are that you need to remove the WSID line or even the order of the entries in the DSN file. But none of these suggestions work.
So I compared the two files again and I noticed that the filesize of my generated DSN was slightly bigger. So let’s look again at the script:
echo DRIVER=SQL SERVER >> %ODBC%
See the space right before the >>? This means that after each line in the dsn file there’s a space too. If you open the file with a Hex Viewer you can easily see the spaces (ASCII value 20):

So the solution is to change this (for all lines) to:
echo DRIVER=SQL SERVER>> %ODBC%
After that it works perfectly!
5 Nov
Dirk Schmitz send me his Python version of encrypting the RDP Password:
pwdHash = win32crypt.CryptProtectData(u"MYPASSWORD",u‘psw’,None,None,None,0)
print binascii.hexlify(pwdHash)
Read the original article here: http://www.remkoweijnen.nl/blog/2007/10/18/how-rdp-passwords-are-encrypted/
1 Nov
I had to lookup some users in Active Directory today which I received by mail. Offcourse I got full users name while I needed either samAccountName or full adsPath. Usually I write a small VBS script to do the lookup and paste this in Excel for further processing. But today I decided that an Excel function to do the lookup would be nice. So I wrote it.
The function is called GetAdsProp and allows you to search on a specific AD field in the whole AD tree and return the value of another field.
28 Oct
Script to clear SQL Transactions Logs
Did you know that when you backup a SQL database with Backup Exec (with the SQL Agent) the transaction log is not cleared? This means that if you use the full recovery model your transaction log keeps growing and growing. I tested this with Backup Exec v11D and you can only create a seperate scheduled job to backup the transactions logs but not one to just clear it or truncate it after successfull backup.
Therefore I made a VBS script that clears SQL transactions logs, an option would be to schedule this as a post backup job.
This is the script: