When a site is upgraded from Systems Management Server 2003 to Configuration Manager 2007, software updates are migrated with Legacy appended to the title, and are only migrated so migrated software update distributions continue to work. Migrated software updates cannot be deployed in Configuration Manager.  This sample script hides the software updates that were migrated during a site upgrade. This script was contributed by Doug Eby.

Visual Basic
Edit|Remove
<job id="IncludeExample">
   <script language="vbScript">
        'basic info to run script
        Dim siteCode
        Dim computerName
        Dim userName
        Dim password
         'if site code is not provided by the caller then we need to quit right away.
        siteCode = getCmdLineParameter("sitecode", "")
        if siteCode = "" Then
            Call DisplayErrorAndExit("Site code must be provided at command line to proceed" & vbNewLine & _
              vbNewLine & "Syntax:"& vbNewLine & _
              "HideMigratedUpdates /sitecode:*thesidecode* [/computer:*name*] [/user:*theuser*] [password:*thepassword*]", vbCritical, True)
        End If
        userName = getCmdLineParameter("user", "")
        password = getCmdLineParameter("password", "")
        computerName = getCmdLineParameter("computer", ".")
        'The real execution kicks in after the user input is gathered
        Dim objSWbemLocator
        Dim objSWbemServices
        Dim ProviderLoc
        Dim location
        Dim objUpdate
        Dim colUpdates
        Dim bStatus
        Dim data
        Dim uniqueId
        bStatus = False
        set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
        set objSWbemServices= objSWbemLocator.ConnectServer(computerName, "root\sms")
        Set ProviderLoc = objSWbemServices.InstancesOf("SMS_ProviderLocation")
        For Each location In ProviderLoc
            If location.ProviderForLocalSite = True Then
                Set objSWbemServices = objSWbemLocator.ConnectServer(location.Machine, "root\sms\site_"&siteCode)
                bStatus = True
                Exit For
            End If
        Next
        if bStatus = False Then
            Call DisplayErrorAndExit("Could not find the specified site", vbInformation, True)
        End If
        
        uniqueId = "'UpdateClassification:051F8712-E600-4bee-B7B7-690D43C78948'"
        
        
        'First lets find even if there are migrated states which are not hidden
        if 0 >= getRecordCount(objSWbemServices, "select count(*) from SMS_SoftwareUpdate where CategoryInstance_UniqueIDs = " & _
            uniqueId & " and SourceSite = '"&siteCode&"' and IsHidden = 0") Then
            Call DisplayErrorAndExit("There are no migrated updates present that this site owns and can be made hidden.", _
                vbInformation, True)
        End If
        
        data = getRecordCount(objSWbemServices, "select count(*) from SMS_SoftwareUpdate where CategoryInstance_UniqueIDs = " & _
            uniqueId & " and SourceSite = '"&siteCode&"' and IsHidden = 0 and IsDeployed = 1")
        if data > 0 Then
            if(vbCancel = MsgBox("Out of all available migrated updates, "& data   & " unhidden, migrated update/s have been " & _
                "detected as deployed; It is recommended that such updates should be undeployed first and then made hidden."& _
                    vbNewLine & "Please press [Cancel] to exit the script or press [OK] to proceed.", _
                        vbOKCancel+vbQuestion, "SCCM 2007")) Then
                wscript.quit
            End If
        End If
        
        if(vbCancel = MsgBox("Please make sure that none of these migrated updates is deployed at the child sites; It is " & _
            "recommended that the deployed updates should be undeployed first and then made hidden." & vbNewLine & _
                "Please press [Cancel] to exit the script or press [OK] to proceed.", vbOkCancel+vbQuestion, "SCCM 2007")) Then
            wscript.quit
        End If
        
        set colUpdates=objSWbemServices.ExecQuery("select * from SMS_SoftwareUpdate where CategoryInstance_UniqueIDs = " & _
            uniqueId & " and SourceSite = '"&siteCode&"' and IsHidden = 0" )
        
        If (colUpdates.Count > 0) Then
               For each objUpdate in colUpdates
                    objUpdate.IsHidden = 1
                    objUpdate.Put_
               Next
        End If
    
        wscript.echo colUpdates.Count & " migrated updates were successfully made hidden"
    
        Sub DisplayErrorAndExit(errorInfo, messageType, doExit)
            call MsgBox(errorInfo, messageType, "SCCM 2007")
            if doExit = True Then
                wscript.quit
            End If
        End Sub
    
        'returns value of a cmd line parameter
        Function getCmdLineParameter(name, data)
           If wscript.Arguments.Named.exists(name) Then
               data = wscript.Arguments.Named(name)
           End If
           getCmdLineParameter = data
           Exit Function
        End Function
        
        'returns total number of records after a query is executed.
        Function getRecordCount(sWbemServices, query)
            Dim value
            value = 0
            set colUpdates = sWbemServices.ExecQuery(query)
    
            If (colUpdates.Count > 0) Then
                For each objUpdate in colUpdates
                    value = objUpdate.Count
                    Exit For
                Next
            End If
            getRecordCount = value
            Exit Function
        End Function
        
   </script>
</job>