Set the default Organisational Unit for New Computers in Windows Server

Once you have your domain and group policies set up, it can become frustrating to constantly have to remember to move a new computer into the correct OU.

Luckily in Windows 2003 and above, you can set a default OU:

<code>redircmp ou=ComputersOU,dc=mydomain,dc=com</code>

Remember to replace the path with your own domain’s OU path. Also, your domain has to be running in at least Windows Server 2003 native mode – otherwise you will receive an error:

Error, unable to modify the wellKnownObjects attribute. Verify that the domain functional level of the domain is at least Windows Server 2003:
Unwilling To Perform
Redirection was NOT successful.

To change this:

  • On the server go to Administrative Tools > Active Directory Domains and Trusts.
  • Right-click on your domain name, and click on Raise Domain Functional Level.
  • Set the domain level to at least 2003

Now you should be ready to go!

Deleting files older than a specific date or age

I needed to delete a chunk of cookies today – but I didn’t want to delete them all.

Thankfully there is a handy command that is within Windows versions after XP such as Server 2003 and Vista that will enable to clean up without too many problems.

The forfiles command will allow you to set a specific date for a file so that you don’t delete recent cookies:

<code>forfiles /S /p "C:\Users\John\cookies" /D -150 /c "cmd /c del @path"</code>

If you wanted to be super cool and delete multiple user cookie folders you could do something like this:

<code>for /D %D in (C:\Users\*) DO forfiles /S /p "%D\cookies" /D -150 /c "cmd /c del @path"</code>

This will enumerate all of the user folders in the C:\Users folder and then clean up the cookies folders inside.

If you wanted to – you can change the amount of days from 150 days to any other amount you like by changing /D -150 to any other number of days (or even use a specific date).

How to download BBC iPlayer programmes

I’ve found the BBC iPlayer client very frustrating to use. Even though the client is cross-platform thanks to Adobe Air – it’s slow and sometimes doesn’t allow you to download a programme when you should be able to.

Also, it doesn’t work properly on 64-bit platforms such as Ubuntu (which is what I use), so the process becomes even more difficult.

So, after getting quite fed up with iPlayer still not quite delivering – I had a scoot around the internet and found a very useful program which will download those videos very nicely.

get_iplayer boasts that it can download BBC TV, radio and ITV onto your computer. Not only this, but it can also be scheduled to download your favourite programmes just like a PVR. So it’s like Sky+ or TiVo, but better. But bear in mind the disclaimer:

Of course, to respect the content providers’ wishes and fair-use legislation, you should keep the recorded content for no longer than 30 days (in the UK), not attempt to obtain it from outside of the UK and not redistribute it. get_iplayer is not intended for use in making illegal copies of copyrighted content. Please respect the rights of the content owners when recording. get_iplayer will attempt to remove its recorded content which is more than 30 days old.

Getting Started
First thing’s first, we need to install it. I’ll assume that you’re using Ubuntu Linux for this, but you can install this on Linux, Mac or Windows.

First of all, download the get_iplayer package from the download page. You’ll also need the flvstreamer package to download the high quality videos.

Once downloaded and installed, you’ll be all set to start downloading. The first thing to do is get an up to date list of programmes. Running

<code>get_iplayer</code>

On its own will refresh the BBC feed and list all the programmes curently available. There may be a lot so you might want to search by the title of the programme:

<code>get_iplayer "Top Gear"</code>

will list all of the BBC iPlayer programmes matching the phrase “Top Gear”

Now you decide that you want to download all of the “Top Gear” series, you can download them with:

<code>get_iplayer "Top Gear" --get</code>

This will download all the available episodes of Top Gear as a .mov file. Using additional parameters, you can also download in various formats such as HD .mp4 files.

Alternatively, if you’ve got the link to a program and you want to download it without any fuss – then you just need the URL or the ID of the programme to download it instantly:

<code>get_iplayer --get --pid http://www.bbc.co.uk/iplayer/episode/b007vl20/Will_Smith_Presents_The_Tao_of_Bergerac_Episode_3/</code>

This will download the radio show The Tao of Bergerac onto  your computer without the need for searching for the programme through the get_iplayer command line tools.

There is loads more you can do, such as using get_iplayer as a PVR. The documentation covers the different commands well, and is definitely worth having a squint through. Just remember to watch how much you’re downloading if you have capped bandwidth from you internet provider.

If you feel like something a bit more graphical, the is also a get_iplayer PVR Manager available to try.

Happy downloading!

Edit files with Notepad++ From Anywhere on your Network

Notepad++ is a very handy tool. It rocks.

What is annoying is that if you have it installed on a server, then you have to run NPP before opening the intended file that you want to edit.

Well, no more! Using the power of Group Policy Preferences (which also rocks).

First of all, install NPP onto your server but install it into a shared folder that you can access.

Next, open up Group Policy Management and edit the group policy that your user account is in (or those that you want to enable).

Open up User Configuration > Preferences > Windows Settings > Registry.

Crete a new registry setting:

Hive: HKEY_CURRENT_USER
Key Path: Software\Classes\*\Shell\Open in Notepad++\command
Default: ticked
Value type: REG_SZ
Value data: "\\server\share\notepad++.exe" "%1"

Then log onto a computer and right click on all of those files! Yey!

IIS and those pesky Flash files

Doesn’t it drive you mad when you set up an IIS server in Windows and you forget to add Flash files to the MIME types? You end up debugging what you think is some scripting problem only to remember about 2 hours later that IIS’s file support out-of-the box leaves a lot to be desired.

Well, I can’t stop you or me not wasting time, but I thought that I’d collect up file types here for reference:

Flash
Extension: .flv
Content type: video/x-flv

7-zip
Extension: .7z
Content type: application/x-7z-compressed

WIM – Windows Image File
Extension: wim
Content type: application/octet-stream

TrueCrypt Autorun Script for USB

You can easily create an Autorun file on a USB pen drive to mount and dismount the encrypted file systems. This is very useful for carry portable TrueCrypt USB drives.

The only downside is that using TrueCrypt on the move means that you need administrator rights to access the disk.

Once you plug in the USB stick, you should see the typical Windows menu pop up. You can also right-click on the drive icon to mount, dismount and run the truecrypt application.

AUTORUN.INF

[autorun]
label=MyData
icon=truecrypt.exe
<code>
action=Mount TrueCrypt Volume
open=truecrypt /v MyData.tc /li /q /a /m rm /e</code>
<code>
shell=mounttc
shell\mounttc=&amp;Mount
shell\mounttc\command=truecrypt /v MyData.tc /li /q /a /m rm /e</code>
<code>
shell=dismounttc
shell\dismounttc=Dismount
shell\dismounttc\command=truecrypt /di /q</code>
<code>
shell=runtc
shell\runtc=Run TrueCrypt
shell\runtc\command=truecrypt</code>