Ok, thanks, but I think this script has brought me back to square 1. It fails to map the drives and if I put the common mappings before the If in groups, I get the same error as before.

I have split the mappings in to spearate functions:

MapDrivesGroups
MapDrivesCommon

The problem is with the common mappings. I know there is no prolbem with either machine/network OR the script (USE L: $DriveToMap), so what can it be?