February 28 2012

Powershell MAC address format validation for SCCM computer association

Recently I was writing a Powershell form frontend for SCCM Opearting System Deployment so technicians didn’t need to go into the MMC console to perform refresh, upgrade or new computer SCCM OSD scenarios.  In the new computer scenario, we need to do a computer association between the computer name and MAC address – which needs to be in the 00:00:00:AA:AA:AA format.

Therefore my Powershell form needs to do MAC address format validation. I took a look at this script and made a fair few modifications for my scenario. I’ve shown the relevant sections of my script below – it checks for valid MAC address hex characters and then converts 00-00-00-AA-AA-AA or 000000AAAAAA or 0000.00AA.AAAA formats to 00:00:00:AA:AA:AA format. As I said, this is part of a bigger Powershell form and I use a textbox to display messages, so you will see references to it like $textboxResults.Text or $text which you can ignore or re-use for yourself, the validation part is most important:

$MACAddress = $txtMAC.Text.toUpper()
$inParamsAddEntry.MACAddress =$MACAddress
<# This section checks for valid MAC address hex characters and then converts 00-00-00-AA-AA-AA or 000000AAAAAA or 0000.00AA.AAAA to 00:00:00:AA:AA:AA format #>
$patterns = @(
if ($MACAddress -match ($patterns -join '|')) {$true} else
$text = "$(get-date -format "dd/MM/yy HH:mm:ss") ERROR: Invalid MAC address specified: '$MACAddress'"
$textboxResults.Text = $stringBuilder.ToString()
$Delimiter = ':'
$rawAddress = $MacAddress -replace 'W'
switch ($Delimiter)
{$_ -match ':|-'}
if ($MacAddress -match ":")
$text = "$(get-date -format "dd/MM/yy HH:mm:ss") MAC address $MacAddress already in correct format"
$textboxResults.Text = $stringBuilder.ToString()
for ($i = 2 ; $i -le 14 ; $i += 3) {
$result = $rawAddress = $rawAddress.Insert($i, $_)}
$text = "$(get-date -format "dd/MM/yy HH:mm:ss") MAC address converted from $MacAddress to $result"
$textboxResults.Text = $stringBuilder.ToString()
for ($i = 2 ; $i -le 14 ; $i += 3)
$result = $rawAddress = $rawAddress.Insert($i, $_)
$text = "$(get-date -format "dd/MM/yy HH:mm:ss") MAC address converted from $MacAddress to $result"
$textboxResults.Text = $stringBuilder.ToString()
} # End switch
# Use $result from here onward for correctly formatted MAC address
$rawAddress = $txtMAC.Text.toUpper()
$MACAddress = $txtMAC.Text.toUpper()

So when I run my Powershell form, I have a few scenarios:

Invalid MAC address entered


Correct format MAC address entered


Wrong format MAC address entered


February 27 2012

Printer migration with SCCM and USMT 4 hardlinks

I recently had a situation where I needed to migrate network printers during Windows 7 refresh and Windows XP to Windows 7 upgrade scenarios when using USMT 4 hard link, also known as offline mode. According to the Microsoft Technet documentation (http://technet.microsoft.com/en-us/library/dd560792%28WS.10%29.aspx#BKMK_4) by design this is not possible. However I still needed to get it done.  I used a new XML file called Printers.xml (orginally from MyITForum but slightly modified by me – if you are using the link here then rename it to Printers.xml from Printers.xml.txt) and then added this to my task sequence capture and restore user data steps as shown in the screenshot below:

Once the computer is refreshed or upgraded, the network printers are now there! * Note that this will only migrate the printers, not the print drivers so you may see some printers are migrated and others are not… It’s still best to use logon scripts / GPO preferences to map printers in a consistant manner..

February 10 2012

List of recommended SCCM hotfixes

I’ve often referenced this continuously updated list of recommended SCCM hotfixes for both site servers and clients. I thought that I would share this – http://ccmexec.com/configuration-manager-2007-sp2-hotfix-list/.

As of February 2012, I recommend the following client hotfixes be installed, I’ve also included the component version numbers as it is often hard to track these down:


KB ConfigMgr Client Version Client components updated
KB977176 4.00.6487.2108 Task sequence – 4.00.6487.2108
KB978754 4.00.6487.2115 OSD – 4.00.6487.2115
KB979199 4.00.6487.2120 Inventory agent – 4.00.6487.2120
KB2263826 4.00.6487.2148 Inventory agent – 4.00.6487.2147
KB2276865 4.00.6487.2152 Task sequence – 4.00.6487.2152
KB2278119 4.00.6487.2154 Software Distribution – 4.00.6487.2154
KB977384 4.00.6487.2157 CCM Framework – 4.00.6487.2155
Software Distribution – 4.00.6487.2154
Power Management – 4.00.6487.2157
KB2309968 4.00.6487.2177 Software Updates – 4.00.6487.2176
KB2516517 4.00.6487.2177 Software Distribution – 4.00.6487.2160
CCM Framework – 4.00.6487.2177
KB2536089 4.00.6487.2187 Inventory agent – 4.00.6487.2184
KB2509007 4.00.6487.2188 Software Updates – 4.00.6487.2188
KB2586709 4.00.6487.2192 Task sequence – 4.00.6487.2192


If you need assistance on how to install SCCM hotfixes, see this great post – http://ccmexec.com/2010/12/installing-the-sccm-hotfixes-on-the-clients/.


I would recommend installing the hotfixes in your OS deployment task sequence if possible, so update your installation properties to include something  like PATCH=”C:_SMSTaskSequenceOSDP000001Ai386hotfixKB978754sccm2007ac-sp2-kb978754-x86.msp;C:_SMSTaskSequenceOSDP000001Ai386hotfixKB979199sccm2007ac-sp2-kb979199-x86.msp;”. If you want to add the client patches to client push, add something like PATCH=”\SERVERsms_P00CLIENTI386HOTFIXKB978754sccm2007ac-sp2-kb978754-x86.msp;\SERVERsms_P00CLIENTI386HOTFIXKB979199sccm2007ac-sp2-kb979199-x86.msp;”.

If you are using client push, ensure that you set correct NTFS permissions to the CLIENT folder mentioned above, to allow client to read and execute the hotfixes.


It’s worth being aware that the installation properties have a maximum of about 1000 characters.

Two additional articles that may be of use are –




February 3 2012

Outlook profile settings ignored in Office 2010 SP1 using OCT

I was using the Office Customization Wizard to deploy a MST file for Office 2010 – pretty staight forward – it had some settings in there for for creating Outlook user profiles. It was working without problem. Then I added the Office 2010 Service Pack 1 MSP files to the Upgrade folder (slipstreaming). After this, the Outlook profile settings were no longer applied when a new install was done – whether they were defined setting in the OCT GUI or whether it was a PRF. It turns out that this is a known bug in Service Pack 1 for Office 2010 – see http://support.microsoft.com/kb/2590591. My solution was to use the ‘Automatically configure profile based on Active Directory Primary SMTP address’ setting and leave the Outlook profile setting section blank.