Today I had an issue in an RDSH Farm environment, on Windows Server 2012 R2 with User Profile Disks enabled, when users trying to install Google Chrome extensions get the error “Could not install package: ‘COULD_NOT_GET_TEMP_DIRECTORY'”. This is an issue for several years already with any type of dynamic/mounted volume anywhere in the path of %temp%, %userdata% etc.

What Chrome does is take the path specified in your case c:\users\%username%\appdata\local\chromeDataDir asks the os to dereference it to a canonical path which turns into something like \?\\HardDisk2\Partition1\somepath…. it then checks if this matches a path rooted at a drive letter e.g. D:\somepath which it only does if the disk is also visible under its own drive.

There is a workaround for this issue, described below.

Make a directory under a drive, in our case we used C:\TEMP, and set the permissions that users can make subdirectories, write access etc.

Then we need to set some settings, firstly we set a Group Policy, Configure Logon Script Delay found under Computer Configuration\Administrative Templates\System\Group Policy\ to disabled, this make Group Policy will run scripts immediately after logon instead of Group Policy will wait five minutes before running logon scripts.

We also want to make sure that the temp folder is emptied at the user logoff, this ensures we don’t consume unnecessary disk space on the RD Server. This setting is found in your Remote Desktop Services Collection properties, see the picture below:

Then you’ll make a script called e.g. tmp.cmd and put in these lines:

mkdir C:\Temp\%USERNAME%
setx TEMP C:\Temp\%USERNAME%
setx TMP C:\Temp\%USERNAME%

Save this in a temporary folder and get back to your Group Policies, browse to User Configuration\Windows Settings\Scripts (Logon/Logoff) and double-click Logon. You’ll get a new window like the picture below:

Click on Show Files…, this will open a Windows Explorer at the location \\<domain.local>\SysVol\<domain.local>\Policies\{GUID}\User\Scripts\Logon copy the batch-file tmp.cmd to this location and close the window.

Then click on Add…

Select the tmp.cmd with Browse… or type it in the box manually, click afterwards on OK to close the window.

It should look something like this, click OK to close the Logon Properties.

Let users logon twice to setup the new temporary folder location for them and it should be possible again to install Google Chrome extensions.