Obsolete objects – Reuse your ”Old” SCCM Client Objects in Mixed Mode

Thank you Kristian for youre resolution in this Problem, i tested this script in my test enviroment, it works great.

here is the script, i have also tested in my enviroment with a scheduled task of 5 minutes
have Fun, hope it helps
no guarantie

===========================
Dim swbemLocator
Dim swbemServices

Main()

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       
    Next

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

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

=========================


Comments

Leave a Reply

Follow

Get every new post delivered to your Inbox

Join other followers:

%d bloggers like this: