libreoffice spellcheck fails with roaming profiles

Occasionally I receive helpdesk calls from staff reporting that their LibreOffice spell check has failed, as this issue is not reported often, my initial response is just to clear the users LibreOffice appdata folder and have them launch LibreOffice again.

This would fix the spell check issue and I considered it something the user must have done, as I did not receive that many calls.

However the calls picked up, so I decided to investigate the issue. This is what I have found.

LibreOffice will not load Language modules if the user is not using the RDS server that they originally launched LibreOffice on.

So consider the following scenario:

  1. You open LibreOffice for the first time and you get RDS Server 1
  2. The next time you open LibreOffice, you get RDS Server 2. You will notice that your Language modules are not loaded, so spell check fails to work.
  3. The next time you open LibreOffice you get RDS Server 1 again. Language modules will load now and spell check will work!

As you can see this could be very annoying if you have a lot of servers. So what’s going on?

It seems to relate to the users libreoffice folder. In particular the LibreOffice3userextensions folder (you will find this in the users %appdata% folder). I am not quite sure of what is happening, but if you remove this folder LibreOffice will re-create it the next time you open LibreOffice.

I created a logoff script to delete the %appdata%LibreOffice3userextensionssharedlastsynchronized file when the user logs off an RDS server. The next time they open LibreOffice it will re-create whatever it needs to re-create in order for the Language modules to be imported correctly.

I believe that LibreOffice could fix this issue, so I have opened a bug here: https://bugs.freedesktop.org/show_bug.cgi?id=48017

Though LibreOffice have not been very helpful in fixing it!

rds and citrix printing issues

The major issue with printing in Citrix boils down to the Client Side Rendering Print Provider!

Do you add printers to your remote sessions via group policy / have users add printers into their sessions using the standard windows add printer wizard? Well, if you haven’t experienced many issues yet, just you wait!

Here are some of the issues you will see that all stem from the Client Side Rendering Print Provider in RDS / Citrix (Though I can’t see why this also wouldn’t happen on a PC either).

UAC Prompt when trying to delete a session printer

Here’s a video of a standard user trying to delete a printer they added to their session.

As you can see they receive a UAC prompt! (That shouldn’t happen). So how do I resolve it?

  1. Go to the Client Side Rendering Print Provider registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider
  2. In the users key, expand Printers then Connections. You will need to find out the SID of the user that has the issue, there are many scripts online that can resolve a username to a SID.
  3. Find the print connection that is having the issue, and delete the key. As you can see this key can store many connections that the user does not currently have. This can cause this part of the registry to become really large!
  4. Restart the print spooler and try to delete the connection again.
  5. Done!

In the video above, I don’t give the spooler enough time to restart before deleting the printer, hence why I receiver the error when trying to delete the printer the first time after I restart the spooler.

I understand you could also remove the connection from HKCUPrintersConnections, however that would just be a workaround, I’m trying to tell you why you actually get the issue in the first place!

Printer properties cannot be displayed. Operation could not be completed (error 0x00000002)

Here’s a video of the x00000002 error. Because the Client side rendering print provider caches the printers by ,,printservername,name, you can just connect to your print server using an IP or a fully qualified name and printing will work. Same printer, same print server, different results!

 

This is what lead to confusion for the communications staff where I work, as they thought it was an issue with the cname to the print server, because: cnameprinter didn’t work but fullyqualifiednameprintername did! This had nothing to do with the cname, and nothing to do with communications, but it just had to do with the cached entries in the Client Side Rendering Print Provider.

Case-sensitive printing

There are some applications we use internally that seem to care what case a printer is added. Think of the following scenario:

  1. User adds a printer with lower case, and logs off server 1. The connection will be cached in the Client Side Rendering cache in lower case on server 1.
  2. User deletes the lower case printer on server 2.
  3. User adds the printer this time in upper case on server 1. The client side rendering key will not update to upper case, it will retain the lower case connection.

Now this is no big issue, as most programs don’t care, well… some do!

I’ve seen enough! How do I fix it?

Download and install Microsoft KB2778831

It’s not part of regular windows updates, so you have to request it (at least at the time of this writing). It resolves the issues!
Also, if you use the Citrix Printer Server / Client this issue also doesn’t appear (and I plan to move to it ASAP after testing)

The pain I experienced

It took me some time to realise that this was the issue. I turned off client side rendering in both Group Policy and on the Print Server, neither of these fixed the issue.

The communications department blamed my cname for the print server as the issue, and recommended putting the cname into the hosts file of all computers (terrible idea by the way, and I had to untangle that mess).

In the end this hotfix fixed the issues above. Install it if you want to keep your sanity!

no default mail client

Have you been getting these errors?

NoEmailClientError

Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client.

Well! I get it a lot as well. Let me tell you why it happens and how to fix it!

Different bitness

If the program you are trying to email from is a different bitness from the Outlook you have installed; you will get this error. For example:

  1. If you have 64bit Outlook installed and try to email from a 32bit application.
  2. If you have 32bit Outlook installed and try to email from a 64bit application.

In the above scenarios you will see the default mail client error. There are some work arounds though!

Workarounds

  1. Uninstall your current version and install the other version.
    1. If you have 64bit Office, uninstall it and install 32bit Office
    2. If you have 32bit Office, uninstall it and install 64bit Office
  2. If you have 64bit Outlook installed I believe it is possible to have 32bit applications email correctly. Follow the steps here on this webpage.

I have not tried the instructions but from a cursory glance they look reasonable.

Unfortunately I have not found a way of emailing from 64bit applications with 32bit Outlook installed. Except there is a hack to do if for .NET applications!

.NET Applications

When .NET applications are built in Visual Studio, most of the time they will be built with platform of Any CPU. .NET applications have the advantage of running across multiple CPU types. If you run a .NET application on a 32bit computer it will be 32bit, run it on 64bit and it will be 64bit. Sounds Amazing!

Well, it’s not that amazing because we have 32bit Office installed on a 64bit computer. These .NET applications are deciding to run as 64bit applications and because of this they are throwing this error around like monkeys flinging poop. There is a solution!

Grab corflags.exe off MSDN, and then run it on the .NET application you are having trouble with:

corflags.exe dotnetexecutable /32BIT+ /Force

This tells the application to be 32bit in 64bit environments. I have tried this on several applications and it’s fixed the issues I was having.

Email Client registry settings are incorrect

Just so you know, I have very VERY rarely actually found that the client registry settings are incorrect. But hell, the steps to fix the registry settings can be found in Microsoft KB813745.

Hopefully the above helps you out!

issues with RDS virtual IPs

We run Cisco Ironports to monitor internet usage and block websites to certain staff etc. When authentication is enabled with the Ironports, and you are using Internet Explorer; Internet Explorer will silently authenticate using the current users credentials against the Ironport device. The Ironport will then save the IP address of the Computer using Internet Explorer, and assume all internet requests from that IP are coming from the user that originally authenticated.

This presents a problem in Citrix XenApp, as multiple users may be using the one server, which only has one IP address. If the first user to log onto the XenApp Server is a company director with full internet access, the Ironport will grant all subsequent users that log onto the server the same internet access. Hey all the traffic is from the same IP!

To get around this issue the Ironports offer a different method than using an IP address for remembering internet access, using a session cookie. From within Identities, under Authentication in the Ironports you can create an Identity, provide a list of IP addresses (your XenApp servers) and set the surrogate type to Session Cookie. From now on, when users try to access websites from servers that have an IP in the identity created above, Internet Explorer will be given a cookie for each website the user visits. Ironports will now refer to the session cookie rather than the IP address of the server for access.

Now internet monitoring and website blocking will work for users on RDS and Citrix XenApp servers!

Well… it’s not all rainbows and unicorns…

Session cookie based authentication is… well… shithouse. It’s terrible and I have no idea why they even offer it as a solution it’s so woefully inadequate. Here are some of the issues we have encountered:

  1. Applications that require Internet Access, and don’t know how to handle a proxy asking for authentication… don’t work
    • As now the Ironports authenticate you on a site by site basis, if you are running an application that requires an external resource, the ironport will ask the application for credentials, as most applications don’t know how to handle these credential requests, they usually complain that they can’t access the internet.
    • If you were using IP based authentication then once the Ironport knows you are using a certain IP, it won’t bug you for credentials for some time. This allows applications that require internet access to work!
    • You could also set the websites to require no authentication to get around the issue, but do you really want to figure out the URLs of each website
  2. Websites with urls with less than 3 characters in before the domain (such as t.co) just don’t work at all unless you want to also put them into your no authentication website list.
  3. Websites that have dynamic content that pull from other locations will fail to work.
  4. Sometimes websites won’t work until you have the user clear their cookies.

What has this got to do with Virtual IPs?

Well, if we could somehow give each Citrix User a unique IP, the issues above would go away! By enabling Virtual IPs on your RDS server each user will get their own unique IP address. People on Cisco forums also recommend enabling Virtual IPs to get around the issues stated above (although I seem to be unable to find official documentation on it).

So it should just be as simple as getting an IP range from your network guys and enable Virtual IPs right? Well… you would think so!

Enabling Virtual IPs

There are good resources on this already out there, I followed the following articles:

  1. Virtual IPs in XenApp
  2. Configuring Remote Desktop IP Virtualization: Part 1
  3. Configuring Remote Desktop IP Virtualization: Part 2
  4. Configuring Remote Desktop IP Virtualization: Part 3

After following the above and enabling Per Session IP Virtualization, I got it working on my test sever! But then I started to do some testing, and boy… Virtual IPs break a lot of things!

IP Virtualization randomly does not work

I’m not quite sure of what causes it, but if you run the following command I have had quite a lot of success with it beginning to work again:

netsh winsock reset

IP Virtualization fails on Servers provisioned in VMWare ESX/ESXi

I did not encounter this as we are running a newer version of VMWare, but I thought I would mention the issue if you are having it. Go here for a resolution: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1038232.

Sessions with Virtual IPs cannot LDAP

This effects so many things, but mainly Outlook. Outlook won’t connect to Exchange if it can’t connect to the domain, and how does it connect to the domain? LDAP of course! You will need to install Microsoft KB2619880

Group Policy fails to apply when Virtual IPs are enabled

Since enabling Virtual IPs I have seen Group Policy fail to apply far more often. You will need to install Microsoft KB2647582

Cannot shadow users with Microsoft Remote Assistance Tool on servers with Virtual IPs enabled

I could not find anything on the internet about this, so I created a technet forum post about it here. In the end the issue is: if you don’t have an administrative user logged onto the servers console session, you will not be able to shadow users on that server.

I contacted Microsoft Support about this issue, they worked on it for a few weeks before contacting me saying this is “by design”. I have requested Microsoft update their documentation and create a KB article to reflect this issue. I have not heard back yet but I will keep you posted.

I was still having difficulty with shadowing staff, in the end I created the following registry key:

HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\TSAppSrvVirtualIPPerSessionraserver.exe

It just has to be an empty key, seemed to fix the issue for me. I found that RAServer.exe was looking for this key when I ran procmon. I created the key and the issue went away!

Conclusion

Sure you can enable Virtual IPs, just be prepared to deal with all the issues associated with it. I can also recommend that you stay away from Cisco Ironports… they are rubbish.

find space with LDAP query

I looked everywhere and couldn’t really find an answer to this!

The company I work for had some legacy system that interfaced with the Active Directory, when a users attribute was emptied in the software, the software did not clear the attribute in AD, it just put a space character. 😦

This has been annoying for us as applications such as Exclaimer Mail Signatures have a if attribute has a value, write the attribute into the email signature. When peoples Mobile numbers are just a space in AD, it does technically have a value!

So I needed to find a query to fix this.

Find users with spaces in attributes

(objectCategory=user)(homePhone=20)

You can use ascci characters in an LDAP query. The ascci character for space (in hexadecimal) is 20. The backslash is an LDAP query escape character. The query above should find all the users that just have the space character in the homePhone attribute.

How to clear them all

Now that the offending accounts have been found, it’s time to fix em! Use PowerShell, and run this command:

Get-ADUser -LDAPFilter "(objectCategory=user)(homePhone=20)" | Set-ADUser -Clear homePhone

Done!

no default mail client

Have you been getting these errors?

NoEmailClientError.png

Either there is no default mail client or the current mail client cannot fulfill the messaging request. Please run Microsoft Outlook and set it as the default mail client.

Well! I get it a lot as well. Let me tell you why it happens and how to fix it!

Different bitness

If the program you are trying to email from is a different bitness from the Outlook you have installed; you will get this error. For example:

  1. If you have 64bit Outlook installed and try to email from a 32bit application.
  2. If you have 32bit Outlook installed and try to email from a 64bit application.

In the above scenarios you will see the default mail client error. There are some work arounds though!

Workarounds

  1. Uninstall your current version and install the other version.
    1. If you have 64bit Office, uninstall it and install 32bit Office
    2. If you have 32bit Office, uninstall it and install 64bit Office
  2. If you have 64bit Outlook installed I believe it is possible to have 32bit applications email correctly. Follow the steps here on this webpage.

I have not tried the instructions but from a cursory glance they look reasonable.

Unfortunately I have not found a way of emailing from 64bit applications with 32bit Outlook installed. Except there is a hack to do if for .NET applications!

.NET Applications

When .NET applications are built in Visual Studio, most of the time they will be built with platform of Any CPU. .NET applications have the advantage of running across multiple CPU types. If you run a .NET application on a 32bit computer it will be 32bit, run it on 64bit and it will be 64bit. Sounds Amazing!

Well, it’s not that amazing because we have 32bit Office installed on a 64bit computer. These .NET applications are deciding to run as 64bit applications and because of this they are throwing this error around like monkeys flinging poop. There is a solution!

Grab corflags.exe off MSDN, and then run it on the .NET application you are having trouble with:

corflags.exe dotnetexecutable /32BIT+ /Force

This tells the application to be 32bit in 64bit environments. I have tried this on several applications and it’s fixed the issues I was having.

Email Client registry settings are incorrect

Just so you know, I have very VERY rarely actually found that the client registry settings are incorrect. But hell, the steps to fix the registry settings can be found in Microsoft KB813745.

Hopefully the above helps you out!