## Endless Night

Just finished listening to Agatha Christie’s “Endless Night”. It was an amazing listen. Very unlike in tone and story to Dame Christie’s usual detective stories (but with a plot twist she has used in the past but which nevertheless came as a surprise to me here too). This was a dark story and I enjoyed it!

Came across the following from William Blake’s “Auguries of Innocence” via this book and I liked it a lot:

Man was made for joy and woe;
And when this we rightly know,
Through the world we safely go.

Joy and woe are woven fine,
A clothing for the soul divine.
Under every grief and pine
Runs a joy with silken twine.

Every night and every morn
Some to misery are born,
Every morn and every night
Some are born to sweet delight.

Some are born to sweet delight,
Some are born to endless night.

## Adding Registry keys to NTUSER.DAT for multiple users

A while ago I had pointed to a blog post I found wherein the author wrote a script to push registry keys to the NTUSER.DAT profile file of a large number of users. I wanted to try something similar in my own environment and while I didn’t go with the script I found I made up something quick and dirty of my own. I know it isn’t as thorough as the one from that blog post (so I’ll link to it again) but it serves my need. :)

So here’s the deal. I have a bunch of profiles located at “\\path\to\profiles\ctxprofiles\$“. It has both v4 and v6 profiles. I’d only like to target the v4 profiles, and that too a specific user for testing. This user’s name contains the word “CtxTest” so I match against it. (Post testing I can remove the pipeline and target everyone).

All I do is get the list of folders, and for each of them load the NTUSER.DAT file from the correct location (it’s under a folder called UPM_Profile as I am using Citrix UPM). I just use the REG commands to load the registry hive, import a registry file, and unload the hive. Easy peasy. No error checking etc. so like I said it’s not as great a script as it can be.

## [Aside] How to roam AppData\Local too

Came across this video from James Rankin. Apart from being an excellent video, it has one important thing which I felt I must note down here as a reference to myself. I always thought AppData\Local and AppData\LocalLow were not synced as part of your roaming profile because they were special in some way. Today I realized that there’s nothing special about them. They are not synced because of a key called ExcludeProfileDirs in HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Winlogon. Any folder mentioned there is not synced as part of your roaming profile. Nice!

So to make AppData\Local roam, simply remove it from that registry key. Then selectively add any sub-folders you might want to exclude.

## XenApp and Run/ RunOnce keys

Reminder to myself: the Run and RunOnce entries in HKLM and HKCU are not processed if an application is launched via XenApp. That’s because these keys are processed by explorer.exe and that doesn’t run when you launch single applications (as opposed to the desktop).

## Adding multiple languages via Registry

I wanted to have multiple languages/ keyboard layouts in my XenApp environment. Thought I’d push it out via a registry key change. I forget the blog post I had found the details from but this one has similar info. Basically HKEY_CURRENT_USER\Keyboard Layout has the registry keys you need to modify. Easiest thing to do is add the languages and keyboards you want via GUI (control panel) and then just export the registry keys. My example below has English UK, English US, and Arabic.

This is a good blog post that explains the keys above and also gives a way of deploying this via GPO (i.e. using admin templates).

## Set 7-Zip as the default for zip files

Had to do this for my XenApp install (7-Zip on a Server 2012R2). Thanks to this post which is in turn based on this post. Trick is to put the following into a registry file and double click/ import it on the machine:

After this go to Control Panel > Default Programs and 7-Zip will appear there. You can set it as the default for all extensions/ choose the ones you want.

Update: Frustratingly, I learnt that the Control Panel way doesn’t do the trick for Citrix. Later I learnt that maybe HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ might be where FTAs (file type associations) are stored, so spent some time exporting the keys from there and pushing out via GPO. Turns out that didn’t do the trick either as it includes a hash tying the file type association to the user & machine where it was set to (bummer eh!). Thanks to these two posts [1][2] I learnt that the official approach is to use DISM to export the FTAs for a user and then deploy it via GPO. The FTAs are deployed to machines, so you can’t have per user customizations this way (but the two posts above have some workarounds).

The DISM command is: dism /online /Export-DefaultAppAssociations:c:\ftas.xml.

Update2: Here’s a blog post containing a tool that lets you bypass this hash issue.

Update3: This is a blog post about the OEMDefaultAssociations.xml. This is the file where the default customizations are stored, which you can over-ride via GPO. Or you could edit this file itself per machine. I learnt via trial and error – this file is very sensitive. If there are missing entries (the default ones) or even out of order entries it seems to be ignored altogether.

The entries in this are configured on new user profiles (existing ones are left untouched) and users can modify the associations if they want. The entries in the GPO cannot be changed by users.

## [Aside] ADFS and Windows Proxy

Quick shout out to this blog post on where to set the Internet Proxy for ADFS. Basically, you gotta set it via netsh winhttp proxy.

## A good quote from “Murder is Easy”

Just finished listening to Agatha Christie’s “Murder is Easy” and came across this quote towards the end. Loved it.

Bridget: Liking is more important than loving. It lasts. I want what is between us to last, Luke. I don’t want us just to love each other and marry and get tired of each other and then want to marry some one else.

Luke: Oh! my dear Love, I know. You want reality. So do I. What’s between us will last for ever because it’s founded on reality.