Remko Weijnen's Blog (Remko's Blog)

About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like


5,816 views

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):

hexdump

So the solution is to change this (for all lines) to:

echo DRIVER=SQL SERVER>> %ODBC%

After that it works perfectly!

  • 4 Comments
  • Filed under: Citrix, script
  • 4,318 views

    If you ever download software from Microsoft’s Volume Licensing Site you have probably seen that it uses the Akamai download manager. Sometimes your downloads get interrupted but how to restart the downloadmanager? There’s no entry in the startmenu and not even an icon on the desktop.

    You can restart the downloadmanager though by creating a shortcut to “C:\Windows\DOWNLO~1\CONFLICT.1\Manager.exe”. Please notice the short directory name (~1).

  • 1 Comment
  • Filed under: General
  • 3,893 views

    Today I was deploying some IBM x3550 and x3650 servers with Altiris Deployment Server. IBM Delivers a toolkit for Altiris that contains amongst others jobs for configuring raid arrays.

    To do this you need to create a raid policy file and deploy this. I created this policy file:

    [Policy.RAID-1]

    AppliesTo.1 = t:ServeRAID-8k-l,d:4

    Array_Mode = CUSTOM
    Array.A = 1,2
    Array.B = 3,4

    Logical_Mode = CUSTOM
    Logical.1 = A:FILL:1
    Logical.2 = B:FILL:1

    As you can see the policy only applies to the type of array controller in my servers (t:ServeRAID-8k-l). This way we prevent applying the policy to other configurarions. I have a 4 disk configuration (d:4) and want to create to RAID 1 arrays (A & B). On each array one Logical drive with the maximum size (FILL parameter).

    Read the rest of this entry »

    25,826 views

    There are several patched terminal server dll’s floating around in the net to allow multiple concurrent Terminal Server session on Windows Vista with Service Pack 1. But they all have the same limitations:

    It’s not possible to start a session to Localhost, this is because the Terminal Server client does a check to see if you are running Personal Terminal Server (Vista/XP) and denies Localhost or 127.0.0.1 if true (127.0.0.2 works though).

    It’s not possible to start multiple sessions with the same user. The patch for Vista RTM did allow for this but in Service Pack 1 some Terminal Server code has moved to the Local Session Manager (lsm.exe) so we need to patch this file as well.

    Offcourse we need to patch Terminal Server to allow unlimited session on Vista as well.

    VPatch files are in the download link below.

    Vista SP1 Patches (8951 downloads )
    10,448 views

    A while ago I included a new undocumented API into my JwaWinsta unit which is called WinStationServerPing. This API “pings” a Terminal or Citrix server and verifies that Terminal Server is up and running. It is not the same as a regular networking ping! This API actually makes a connection to a (remote) Terminal Server and verifies that Terminal Server runs and accepts connections.

    I wrote a small cmdline tool that uses this API to ping a Terminal Server which can be used to quickly determine if a Terminal Server is up and running. I named it WTSPing.

    So how does it work? Open up a command prompt (Start -> Run -> cmd) and type WTSPing /? to see the help:

    Read the rest of this entry »

    14,350 views

    I needed a script to logoff all running Terminal Server sessions in order to rollout an install package. As you might know there is a commandline tool to logoff a session, it’s called logoff.exe.

    These are the commandline options:

    LOGOFF [sessionname | sessionid] [/SERVER:servername] [/V]

    sessionname The name of the session.
    sessionid The ID of the session.
    /SERVER:servername Specifies the Terminal server containing the user
    session to log off (default is current).
    /V Displays information about the actions performed.

    No option to logoff all sessions is there?

    On a Terminal Server there is a special session called the Listener session, you can see it with TSAdmin in the sessions tab:Listener

    A Listener is associated with a protocol (Microsoft RDP by default) and is used to setup new sessions. If you logoff a Listener session it will logoff all session that were created through it. Great, just what we need!

    So Logoff 65536 will do the trick? Let’s try:

    logoff

    So Logoff is smart enough to ask for confirmation, we can prevent this by using the following commandline:

    Echo Y ! Logoff 65536

    6,712 views

    Justin Shepard converted my code to encrypt RPD passwords to VB.NET:

    5,137 views

    Recently I needed to convert a C header file to Delphi which contained bitfields. Let’s take a look at a sample structure that contains bitfields:

    It means that there is a DWORD (Cardinal) dwValue1 followed by a bitfield with the size of a ULONG (32 bits). In this bitfield 4 values are defined (BitValue1..4) which are used as boolean’s because the value can offcourse be 0 or 1. Since Delphi doesn’t know a bitfield type the question is how to translate it. Usually it would mean that we simply treat the whole bitfield value as a ULONG and extract the required properties by applying a bitmask (shl/shr). Starting from BDS2006 we can define a record with propertes and use getters and setters. Using this technique we can present boolean values to the user:

    Code completion shows that the record has one DWORD Value and 4 Boolean Values which is just what we want!
    CodeCompletion

    Offcourse we need to implement the Getters and Setters:

    We can even add a constructor to it, this can be used to e.g. initialize the record (in the example below we fill with zeroes). Note that only a constructor with at least one argument can be used:

    So why not use a class instead of record? The answer is that a class is just a pointer we can never pass this to a function, procedure or api call that expects a record. But if we want to support older Delphi versions, like Delphi 6 or Delphi 7 and even Delphi 2005, which are still used a lot we need to find another solution. I came up with (ab)using sets to emulate bitfields, we can do this because a set is actually a set of bits (limited to 256 bits). The example structure could look like this if we use sets:

    We can use normal set operations to get and set bitvalues:

    Settings like minimal enum size and record alignment are important because we need to asssure that te record size matches the C structure’s size (especially when using structures with a lot of bitfields. I choose to do this with a litte trick, first I declare some constants:

    We use these constants to force the correct size, in the example the bitfield was a ULONG which is 32 bits. We add the al32Bit constant to the bitfield:

    So I thought I had it figured out… until I came to this line in the C header file:

    So we have a bitfield consisting off multiple bits! This gave me some headaches but I finally came up with the following approach

    We need a helper function to retreive the numeric value of ColorDepth:

    The helper function is used like this:

    Some limitations remain, although I don’t think you are likely to encouter these:

    • A Delphi Set can contain at most 256 values.
    • The ValueFromBitSet function returns an Int64, so values that do not fit in an Int64 cannot be returned.
    • Values in a Set need a unique name.
    3,015 views

    Vijayshinva Karnure wrote a very cool article about running Server 2008 as a desktop os or rather as a Windows Vista replacement. It seems that besides additional features like Hyper-V, Server 2008 runs approx. 20% faster than Vista.

    If only upgrading Vista to Server 2008 would be possible… (has anyone ever tried)?

    Links:

    http://blogs.msdn.com/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx

    http://vista.blorge.com/2008/03/11/windows-server-2008-is-20-faster-than-vista/

    7,783 views

    Open Server Manager and in the Security Information tab click Configure IE ESC. An improvement in Server 2008 is that you can disable it for Administators but enable it for Normal Users, this is nice for Terminal Server and Citrix environments.

    Internet Explorer Enhanced Security Configuration

  • 5 Comments
  • Filed under: Windows 2008
  • Blogroll


    Categories


    Archives