Remko Weijnen's Blog (Remko's Blog)

About Terminal Server, Citrix, Delphi and other stuff

Archive for the ‘script’ Category

Yesterday I was packaging an application called Kluwer Juridische Bibliotheek. When the user first starts this application a screen with the License Conditions pops up and it must be accepted:

KluwerEULA

I always try to remove such things as I don’t think it’s necessary for every user to accept it.

(more…)

I usually change the text below the “This Computer” icon to reflect the current username and servername:

UserOnComputer

This is an ancient trick, just set the the LocalizedString Value of the following key:

to “%USERNAME% on %COMPUTERNAME%”.

It get’s a little more complicated if you want to set this from a script, because the environment variables are replaced with the actual value BEFORE they are entered in the Registry.

(more…)

I remembered from a previous project that when the Citrix Web Interface this is caused by a setting called generatePublisherEvidence in the Aspnet.config file.

This behaviour has been documented by Citrix in CTX117273.

If you read it carefully you will see the note that you need to fix it in 2 places for an x64 system.

If you know me a little than you have probably guessed I wanted to fix this with a nice script. I have chooses PowerShell this time because it has good support for XML and I made a one-liner so I can easily use it in an Embedded Altiris script.

The script changes the config file for both x86 and x64:

EDIT: If you run by commandline you need to care of quotes within quotes, easiest thing to do is to use double quotes (“) to surround the commandline and use single quotes (‘) for Strings inside the commandline:

A while ago I created a script that I can run as embedded script in Altiris that creates a Server Manager Answer File (for Server 2008).

I could have simply done an echo >answer.xml but I wanted a well formed XML that could be read and displayed in an XML editor or Internet Explorer when needed.

I use the Microsoft.XMLDom object in the script the create the XML and I think the code is easy to understand so I will just show it here: (more…)

I ran a VBScript that queries the Win32_Product WMI class on Windows 2003 but it returned error 0×80041010 instead of the expected results.

I looked up that errorcode and it means WBEM_E_INVALID_CLASS. This happened because the “WMI Windows Installer Provider” was not installed.

You can do this through Add/Remove Programs | Windows Components | Management and Monitoring Tools | WMI Windows Installer Provider.

Or if you want to do this with a script you can use SysocMgr:

  • 0 Comments
  • Filed under: Altiris, script
  • 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.

    (more…)

  • 0 Comments
  • Filed under: script
  • 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!

  • 2 Comments
  • Filed under: Citrix, script
  • Encrypt RDP password in Python

    Dirk Schmitz send me his Python version of encrypting the RDP Password:


    Read the original article here: http://www.remkoweijnen.nl/blog/2007/10/18/how-rdp-passwords-are-encrypted/

  • 4 Comments
  • Filed under: Programming, script
  • Query Active Directory from Excel

    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.

    (more…)

    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:

    (more…)

  • 2 Comments
  • Filed under: script, SQL Server
  • Profile

    Tags

    Recent Tweets

    Views

    Donate


    Blogroll


    Categories


    Archives