Copying User profiles while in use

I know it’s not a feasable way to do it but sometimes you can’t get around to copy a user profile while it’s still locked (think: Windows locks it even after the user logs out).

To copy such a pesky profile I use Hobocopy:

hobocopy /full /y /r “%HOMEDRIVE%\%HOMEPATH%” “C:\UserProfileBackup”

The program makes use of shadow copies to perform the process so the resulting file will still be locked but at least it was copied. This becomes quite useful when used in conjunction with, for instance, the portable version of CCleaner and it’s /AUTO switch.

Moving folders to the server side

Wow, the second Windows-related post today? Something horrible must be happening to me right now…

Anyway, you may know a situation like this: Many clients, one server and a terribly stubborn application that just wants to write into that one pesky folder on the local hard disk. Needless to say that thanks to your policies that won’t last a reboot.

So, how can we tame applications like that? People want their data to be available across the network, in a central location/database. If the application’s data is not transaction-dependant you’re in luck.

Unix-lovers know hard-, soft- and symlinks. Hardlinks are available on Windows XP as well, but the truly wonderful stuff comes in on Vista: You get the two other missing types.

That doesn’t mean that XP users are left in the cold, you can download the necessary tool from various sources on the net for free and give it a shot.

So, what is this mysterious tool? It comes with Vista and is called MKLINK. Just use it like this:

mklink /D "Damn local database folder" "\\SERVER\DatabaseFolder"

Yes, we can actually point to a UNC path and — given the client users have sufficient rights — will be able to browse the folder just like any other folder on your file system. That’s pretty sweet and incredibly useful for ol’ haggy applications.

Don’t forget that this operation (just like everything fun) requires elevated access to do!

Temporarily register fonts using a normal User account

As you may know Windows is quite stiff sometimes. You can’t add additional font directories like you’d do on Unix. Another stiffy problem is that Windows requires an elevated account for operations like installing/removing fonts from the system. That’s quite troublesome at times.

This is exactly when my little tool jumps in. With RegisterFont you can add a number of fonts to your font cache without using an elevated user account. The downside is that all the changes persist only ’till the next reboot; Windows will rebuild it’s cache and the changes will be lost.

Anyway, the archive contains a binary as well as the C# sourcecode to this small utility. Use it like that:

RegisterFont.exe add font1.ttf font2.ttf font3.ttf … font1000.ttf

Easy, huh? If you don’t want to add fonts but remove them, substitute the “add” parameter with “rem” and you’ll be set. I didn’t bother to link up to the MSDN entries explaining the API, this is just a quick and dirty tool I wrote because we were in need of a quick solution to a problem 🙂 .

Update 2010-08-27: dcpurton wrote a tool in C to accomplish the same goal but without the .net dependencies. Best of all: Sourcecode is also available 🙂 .

Mandatory profiles w/XP

Mandatory profiles are an ideal way of keeping a complete set of workstations in sync in regard of their visual appearance and settings.

One thing I was stuck at: Whenever I copied a profile and renamed the NTUSER.DAT to NTUSER.MAN the profile simply wouldn’t load the preferences from it, resulting in ugly window decorations, empty start menus etc. Why is that?

The reason lies in the permissions on HKCU. To circumvent this undesired effects you can use Computer -> Properties -> Advanced -> User Profiles -> Copy To… — and now comes the thing — before clicking OK also click the button on the bottom of the form to set permissions. I used DOMAIN\Everyone but as usual… results may vary.

This way it worked fine, though.
It’s a shame that this little click isn’t mentioned in 90% of the quick’n’dirty guides on the net, it really does make a difference.