Wednesday, 12 September 2012

PXE & OSD Builds Failing - conflicting records

If you have ever had issues with your PXE boot failing when you try to rebuild a machine that already exists within SCCM then this may help you out.

I'd been spilling over this one on and off for a while when I discovered that these machines were appearing in "Conflicting Records". 

Conflicting Records within SCCM console

You have a few options here.  We can get SCCM to manage conflicting records by chaging the setting site wide:

  1. Navigate to System Center Configuration Manager / Site Database / Site Management / <site code> - <site name>
  2.  Right-click <site code> - <site name> and then click Properties
  3. Under the "Advanced" tab, you can choose Manually resolve conflicting records or Automatically create new client records for duplicate hardware IDs.
  4. OK
Another option is to manually resolve conflicting records:

From conflicting records as above select the conflicting record and look in the actions pain and you will see  few options:
  1.  Merge - combines the new record with the existing one merging together
  2. New - creates a brand new record for the conflict
  3. Block - creates a new record but blocks it
Then there is another really cool way of doing it!!

  •  Save this into a file called "Merge.vbs" to somewhere of your choice - we will be using it in  a few steps time - don't forget to check your formatting if you copy and paste - the "quotes" can sometimes 'mess up' etc
Dim swbemLocator
Dim swbemServices


Sub Main()
Dim oProviderLocation
Dim oLocation
Dim oReg
Dim oPendingRegs
    Set swbemLocator = CreateObject("WbemScripting.SWbemLocator")
    swbemLocator.Security_.AuthenticationLevel = 6 'Packet Privacy.
    Set swbemServices = swbemLocator.ConnectServer(".", "root\SMS")
    Set oProviderLocation = swbemServices.InstancesOf("SMS_ProviderLocation")
    For Each oLocation In oProviderLocation
        If oLocation.ProviderForLocalSite = True Then
            Set swbemServices = swbemLocator.ConnectServer(oLocation.Machine, "root\sms\site_" + oLocation.SiteCode)
        End If       

    Set oPendingRegs = swbemServices.ExecQuery("SELECT * FROM SMS_PendingRegistrationRecord")
    For Each oReg In oPendingRegs
        Resolve 1, oReg.SMSID

End Sub

Sub Resolve(action, SMSID)
Dim InParams
    Set InParams = swbemServices.Get("SMS_PendingRegistrationRecord").Methods_("ResolvePendingRegistrationRecord").InParameters.SpawnInstance_
    InParams.Action = action
    InParams.SMSID = SMSID

    swbemServices.ExecMethod "SMS_PendingRegistrationRecord","ResolvePendingRegistrationRecord", InParams
End Sub

  • Ensure that conflicting records on the advanced tab of site properties is still set to "Manually Resolve Conflicting Records"
  • Create a new status filter rule with the following properties: 
Message ID: 2642

  • On the actions tab select "run a program" and specify the above script we created.  If on a x64 server you may need to specify the full path to "cscript.exe" i.e. C:\Windows\SysWOW64\cscript.exe C:\SCCMTools\Merge.vbs”
Relying on the status filter rule will mean that the script will only run when it detects the 2642 event however you can run the script manually if you want to tidy up what is already there.

I have to thank a great SCCM consultant; Dean Lockwood at BDS services for this - although he will tell you it was my inspiration that prompted the outcome ;)

No comments:

Post a Comment

Let me know if this helped.

I'd really appreciate any comments (well, only nice ones) so please feel free to let me know what you think of the blog and also ask for further help...