Archive | Uncategorized RSS feed for this section

SCCM – Duplicate Hardware Identifiers

8 Jan

Once upon a time, all computers came with an Ethernet port and the MAC address of that was effectively an identifier for the computer. If you configured SCCM to only deliver a boot image to unknown hardware then everything worked – a new machine would install but trying to PXE once it was installed got you nowhere.

Times change and it’s now extremely common for laptops to come without wired Ethernet (and even without Wi-Fi if you use HP but that’s another story …) To install them we can use USB Ethernet adapters or docking stations but we need a way to tell SCCM to allow reuse of a MAC address. In versions of SCCM prior to 1610 this was done by adding MAC addresses to a REG_MULTI_SZ value under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SMS\Components \SMS_DISCOVERY_DATA_MANAGER . This worked but wasn’t easy to do – you had to make sure you got the format exactly right and you had to be able to edit the registry of a site server.

Since SCCM 1610, this has changed. You can now add MAC addresses through the console (Administration > Overview > Site Configuration > Sites > <Site> > Hierarchy Settings > Client Approval and Conflicting Records.

We want to make it easy for the deskside support engineers to see the list of MAC addresses. In the older version I just ran a script at regular intervals to dump the list from the registry to a web page that they could read. I wanted to do the same with the new system so had to find out where the MAC addresses are stored – the console doesn’t just give an easier interface to the registry key.

I guessed it would be in the SQL database but finding the right table proved difficult. A bit of Googling found which told me how to get a list of all the fields in every table in a database. A small edit gave me this query:

SELECT AS Table_Name , AS Column_Name , AS Data_Type ,
 P.max_length AS Size ,
 CAST(P.precision AS VARCHAR) + '/' + CAST(P.scale AS VARCHAR) AS Precision_Scale
FROM sys.objects AS T
 JOIN sys.columns AS C ON T.object_id = C.object_id
 JOIN sys.types AS P ON C.system_type_id = P.system_type_id
WHERE T.type_desc = 'USER_TABLE' and like 'mac%' and<>'machineid'


with just 49 rows in the result set it was pretty easy to find the table called “CommonMACAddresses” and a quick check of its contents showed me I’d found the right table.



Iceland – moving inland

10 Jun

The people give a sense of scale to the caldera

A caldera looks like it might be the crater of a volcano but it’s actually caused by land collapsing after a volcanic eruption. Wikipedia has a good description but Kerio is pretty impressive!

I took a few photos here, including ones of the information boards. The boards are really impressive and present at most of the sites of interest – they were all in Icelandic and English with other languages added occasionally.

We didn’t spend long here because we had a lot more to see and the next stop was at the visitor centre for Þingvellir (the “Þ” is pronounced “th”) This is important because it’s the site of the original Icelandic parliament but it’s geologically important because it effectively straddles the rift between the North American and Eurasian tectonic plates. You can pretend to stand with feet on either side of the gap which makes it well worth a visit 🙂

The visitor centre is interesting and has good toilets (actually, all the public toilets in Iceland are good – there just aren’t very many of them!) but it also gives an excellent overview of the area. You used to be able to walk from the centre down into the valley but recently a crack has opened up which means that the path has been closed. There’s some rope lava here which you can see  in my photos (rope lava is also known by the Hawaiian name of pahoehoe) and a good model showing the area.

Waterfall at Þingvellir We got back on the coach to go a bit a further along the road and then had a pretty easy walk down into the valley. The weather had really improved and it was actually a really gorgeous day – not at all what you expect in Iceland (2 weeks before we went the temperature was about -10C!)

One of the Icelandic words you see often is “foss” – it means waterfall and you’ll see it often because there are lots of them – the one at Þingvellir isn’t the biggest but it’s quite impressive.

There are more information boards in the area where the parliament met including information about the punishments meted out for various crimes. Given the amount of water I suppose it’s not surprising that drowning was used as a form of execution although apparently only women were drowned. Men were beheaded, hung or burned at the stake.

The sunshine meant that our picnic lunch (provided by the Hotel Dyrholaey and pretty good) was in the sunshine next to the river. The river is absolutely crystal clear (which tells you that it’s not glacier melt – water from a glacier is always cloudy because of the rock flour it carries) but it’s spoiled by people throwing coins into it in spite of the pictogram signs everywhere saying “don’t throw coins”

After lunch we made our way to Geysir. The Great Geysir rarely erupts now but Strokkur goes off about every 10 minutes and is really good to watch (not quite sure why I bothered to upload my video clip – there are far more, far better ones on YouTube already!)


Gulfoss with a touch of rainbow!

The next stop was Gulfoss – one of the biggest waterfalls and very spectacular.

The information board says that the average water flow is 109 m3/s but peaks at 2000; 1m3 of water weighs 1 tonne so that means that there can be 2 000 tonnes of water going over the fall very second! You start to realise just how destructive water can be with figures like that.

It was hard to get good photographs but I’ve put a few here and also uploaded a video (but, again, there are many more available!) I think the video gives an idea of how sunny it was but I should have included people to give an idea of the sheer size of the waterfall.

TV Tuners in Linux

10 Jun

I have an elderly PC running MythTV which has worked well for sometime but the USB TV Tuner I was using failed. Not a major problem; they’re cheap to replace. Unfortunately, the software support is not too good – few manufacturers provide Linux drivers and firmware. I bought my tuner from Maplin (and I’ve just found that it’s now £10 cheaper than when I bought it!) – it’s a KWorld UB499-2T.

A new install of Ubuntu 12.04 almost works (but, as my old German teacher used to say, “If you’re nearly right, you’re wrong” so “almost works” really means “doesn’t work”) so I decided to find out how to make it work. This was not as easy as I hoped so I’ve made some notes which will help me next time I reinstall and might perhaps help someone else!

There are lots of articles on the web which refer to the script “get_dvb_firmware” and just seem to assume it will be present. It’s not present on a default install of Ubuntu but it gets installed if you add the linux-doc package (at least, /usr/share/doc/linux-doc/dvb/get_dvb_firmware.gz gets installed; copy that somewhere safe, unzip it and make it executable) Run the code to get the firmware and then unload/reload the driver

cd ~
cp /usr/share/doc/linux-doc/dvb/get_dvb_firmware.gz .
gunzip get_dvb_firmware.gz
chmod +x get_dvb_firmware
#get the firmware
./get_dvb_firmware it9135
#copy it to the right location
sudo cp dvb-usb-it9137-01.fw /lib/firmware
#Now unload and reload the driver (you could just reboot but Linux never needs rebooting ...)
sudo rmmod dvb_usb_it913x
sudo insmod /lib/modules/3.2.0-24-generic-pae/kernel/drivers/media/dvb/dvb-usb/dvb-usb-it913x.ko

If you now run dmesg you should see that the tuner is found, firmware is loaded and the tuner is ready.

The Kaffeine media player is really good for checking that the tuner is working – stop the Mythbackend service because otherwise it grabs the device.

Iceland – Day 2

30 May

After breakfast we set off in our bus (Lady Scania!) for Solheimajokull – a very large glacier.

The first think you notice is that it’s grey because it’s covered in ash but as you get closer you can see the clean ice and it’s a pretty amazing sight.  The picture hopefully gives an idea of the scale – it’s massive – and some of the pictures here give an idea of the amount of ice in the glacier. It was strangely beautiful but the most interesting thing is the speed at which it’s melting – our guide was last here less than 2 months ago and it’s retreated since then,

We then drove along the main road to Vik -a small town on the coast. You can see a few photos of the town here. The lupins in the picture are not native to Iceland; they were imported from Canada and were planted in a bid to stabilise the sand/ash. Unfortunately, they’ve been much more successful than was expected and are taking over! Apparently, they are being pulled up in parts of the island because they’ve simply become too dominant.

After a lovely coffee break we went down on to the beach. The pictures may not be too clear but the thing which is spectacular about all the beaches here is that the sand is black – all the rock is volcanic so when it gets broken down to sand (it’s actually more like fine grit) it’s also black. It looks pretty spectacular when it’s wet.

Walking up the hillVik is a small town but it does have  a store selling Icelandic woolen products (and many more souvenirs). Their website only lists a fraction of what they sell; I bought a superb hat for about a tenner ( I thought I’d need a hat and I’d managed to leave my own hat at home. As it happened, this day was the only cool day in the whole week so I didn’t really need a hat. It’s such a good hat that I’m sure it will be useful later!)

We had lunch at Hjörleifshöfði (I think; my Icelandic spelling is not too good! I decided not to go up the hill and just wandered around near the beach. Even down at that level the scenery is amazing.

Basalt Columns Reynisfjara was our next stop – this has the most spectacular basalt columns which you can hopefully make out in the photos. Unfortunately, the weather was getting greyer so the light wasn’t too good but it’s still fantastic to see the scenery.


The final stop was Dyrholaey – “Door hole” in Icelandic. It’s a natural rock arch but sadly I failed to get a decent photo of it!


Iceland – day 1

29 May

We flew with Icelandair from Heathrow to Keflavik; the flight left an hour late but we made good time and arrived just 30 minutes late. We were met at the airport by our Trex coach and driver. I can’t spell his name but it’s pronounced “Yoey” (rhymes with Joey) who has turned out to be an amazing asset – a good driver, with a huge knowledge of the country, a good command of English and a willingness to get stuck in with every aspect of our holiday!

The Blue Lagoon

Steamy waters

From the airport we made our way to The Blue Lagoon This is a huge outdoor pool with geothermally heated water and it’s blue because the silica (basically very fine sand in the water) refracts the light and makes it blue. It’s a fabulous place; the water is mineral rich which means that even if you can’t swim, you can just float around in the pool and even at it’s deepest it only comes up to chest height so you can easily walk around. There are also saunas and steam rooms if you want a little more warmth.

Iceland can be a cold place (the clue is in the name!) so a good tip is to not go out through the main door from the changing room. Instead, get in the small pool by the door and then go through the door at the far side of the pool; this way you stay in the warm water and the cold air is not quite such a shock!

My photos of the Blue Lagoon are here

From there we made our way to Hotel Dyrholaey just outside Vik. We arrived quite late in the evening but sunset in Iceland at the end of May is after 2300 so at least the drive was in daylight. The hotel proved to be lovely – the staff were charming and very helpful and the accomodation perfect for our needs.

Linux shell scripting

11 Jan

I am spending more of my time working with Linux so I’m learning some of the things you can do with it

We have a couple of NAS boxes which need to be backed up in a kind of Time Machine fashion. This is relatively easy to do with rsync (which I believe is what Apple’s Time Machine uses). I found this web site which helped me get started and this is what I ended up with. You just have to run this from cron and you get new backups each day which appear to contain the full contents of the source machine but actually only contain new files and a set of symlinks to files which are in a previous backup.


#log start time
date > /tmp/timemachine.log

#folder will be called yyyy-mm-dd
date=`date "+%Y-%m-%d"`

#backup - link it to the most recent folder
#copy from nas02
#and to a dated folder on nas01
#redirect all output to a log file
rsync -a --link-dest=/destination/current sourcemachine.fqdn.tld::source_share /destination/$date >> /tmp/timemachine.log

#remove the "current" symlink (it's not current any longer)
rm -f /destination/current

#and make a symlink to the backup we just made
ln -s /destination/$date /destination/current

#all done so log end time
date >> /tmp/timemachine.log

#and send an email
echo "Backup complete; log attached" | mutt -s "Backup complete for NAS" -a /tmp/timemachine.log -- myemail@email.tld 

Linux shell scripting – 2

11 Jan

My previous post was about using rsync to mimic Apple’s Time Machine; I actually set that up some time ago but just didn’t get round to writing about it.

It’s now been running successfully for over a month and I wanted to find out how much space does it save when you just create hard links to files rather than backing them up. You can’t just use the du command because it counts the files as if they were actually there but find is a command which can help.

If you type:

find . -links 1 -type f

Then you will get a list of files in the current directory which have just one link to them (ie they’re not linked from any other directory so they are “today’s” backup)

that list is very nice but tells me nothing about size. find can take a -exec option which then runs a command for each file

find . -links 1 -type f -exec ls -l {} \;

lists the files in long format so you can see their size but I don’t really want to try and add up all those sizes!

awk will allow me to do some processing on these results:

find . -links 1 -type f -exec ls -l {} \; | awk '{print $5}' 

Here, we’re piping the output of the ls command into awk and getting it to print the fifth column (the size)

Still not ideal; I really want it to add up those numbers for me!

find . -links 1 -type f -exec ls -l {} \; | awk '{ print $5 }' | awk '{total = total +$1}END{print total}'

This takes the long list of numbers and pipes it to another awk command which just adds each number to a variable called “total”. Once it’s finished, it prints that variable.

So, if you run that final command at the top of a directory tree containing new files and hard links to previous files you’ll ge a number – that’s the space taken up by files actually in that directory. Run a du-s for the same directory and you’ll get the total space Linux thinks is in use (ie including all the files that are really just hard links). The difference between the 2 is the space saved by doing this backup.