WMI versus Content Library

Dominique DUCHEMIN 831 Reputation points
2021-10-11T23:05:56.51+00:00

Hello,

I ran a script and its results are:
Items in WMI but not the Content Library

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

UCP00128.3e4a13ad
UCP00128.3e4a61cd

The package UCP00128 does not exist anywhere in the Console ... what should I do to clear this discrepancy between WMI and Content Libray?

139637-2021-10-11-16-20-25-vspsccmdp01-status-01.png

I compare

PS C:\Windows\system32> Get-ChildItem F:\SCCMContentLib\PkgLib*.ini | out-file dir.txt

PS C:\Windows\system32> Get-WmiObject -namespace root\sccmdp -class SMS_PackagesInContLib | format-list -Property PackageID | out-file wmi.txt

the two files have the same packages...

Thanks,
Dom

Microsoft Configuration Manager
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Amandayou-MSFT 11,046 Reputation points
    2021-10-12T07:41:24.467+00:00

    Hi @Dominique DUCHEMIN ,

    Could we know which sccm version is used? 2012 or other? If it is 2012, there is a status message in the Details tab in the Details pane that shows there was a failure to retrieve the package list, we could try to check smsdpmon.log file on the distribution point to see if there is any error in it, and do these operation to try to solve it.

    If the package is not on the site, we must remove the package from WMI on the distribution point. The namespace to connect to is rootsccmdp. The class that contains the list of packages expected is SMS_PackagesInContLib. The simplest way to find the package and remove it from WMI is to run a query on the distribution point such as the following, and then delete the object that is returned, update the content on the distribution point for package.

    If the version is not 2012, we could use the above method to solve the problem.

    For more details, please refer to these articles:
    https://techcommunity.microsoft.com/t5/configuration-manager-archive/troubleshooting-content-mismatch-warnings-on-a-distribution/ba-p/273094
    http://henkhoogendoorn.blogspot.com/2015/07/the-package-list-in-content-library.html
    Note: Non-Microsoft link, just for the reference.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Amandayou-MSFT 11,046 Reputation points
    2021-10-13T08:24:13.42+00:00

    Hi,

    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib where PackageID = 'UCP00128.3e4a13ad'" | Remove-WmiObject

    The PackageID = 'UCP00128.3e4a13ad' seems to be wrong.

    We could run the following powershell to check how many package there are.
    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib"

    And then run the following command:
    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib where PackageID ='PRI0002c'"| Remove-WmiObject
    Note: please input your PackageID

    Finally, we check if the Package is deleted by running the following powershell:
    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib"

    Besides, we could check the packageID on the side of sccm console:

    140079-10131.png


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread

    1 person found this answer helpful.
    0 comments No comments

  3. Duchemin, Dominique 2,006 Reputation points
    2021-10-12T22:04:57.993+00:00

    Hello,

    MEMCM 2103 + KB10036164 + KB10372804
    Smsdpmon.log on VSPSCCMDP01
    The only error seen in this file is:
    Failed to find algorithm ID from registry. Use default algorithm. SMS_Distribution_Point_Monitoring 10/11/2021 4:32:36 PM 6300 (0x189C)
    List
    $WMIPkgList = Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib | Select -ExpandProperty PackageID | Sort-Object
    $ContentLib = (Get-ItemProperty HKLM:SOFTWARE\Microsoft\SMS\DP).ContentLibraryPath
    $PkgLibPath = ($ContentLib) + "\PkgLib"
    $PkgLibList = (Get-ChildItem $PkgLibPath | Select -ExpandProperty Name | Sort-Object)
    $PkgLibList = ($PKgLibList | ForEach-Object {$_.replace(".INI","")})
    $PksinWMIButNotContentLib = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru

    section 1

    Write-Host Items in WMI but not the Content Library
    Write-Host ========================================
    $PksinWMIButNotContentLib
    Foreach ($Pkg in $PksinWMIButNotContentLib){
    Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib -Filter "PackageID = '$Pkg'" | Remove-WmiObject -Confirm
    }
    Results
    PS C:\Windows\system32> C:\source\Script-Invalid_Content.ps1

    Items in WMI but not the Content Library

    UCP00128.3e4a13ad
    UCP00128.3e4a61cd

    Delete
    $WMIPkgList = Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib | Select -ExpandProperty PackageID | Sort-Object
    $ContentLib = (Get-ItemProperty -path HKLM:SOFTWARE\Microsoft\SMS\DP -Name ContentLibraryPath)
    $PkgLibPath = ($ContentLib.ContentLibraryPath) + "\PkgLib"
    $PkgLibList = (Get-ChildItem $PkgLibPath | Select -ExpandProperty Name | Sort-Object)
    $PkgLibList = ($PKgLibList | ForEach-Object {$.replace(".INI","")})
    $PksinWMIButNotContentLib = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru | Where-Object { $
    .SideIndicator -eq "<=" }
    $PksinContentLibButNotWMI = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru | Where-Object { $_.SideIndicator -eq "=>" }
    Write-Host Delete these items from WMI:
    $PksinWMIButNotContentLib
    Write-Host Delete .INI files of these packages from the PkgLib folder:$PksinContentLibButNotWMI
    Results:
    PS C:\Windows\system32> C:\source\Script-DeleteInvalid Content.ps1
    Delete these items from WMI:
    Delete .INI files of these packages from the PkgLib folder:

    The two scripts do not detect the same packages ...

    How to delete the packages from the WMI?
    I tried:
    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib where PackageID = 'UCP00128.3e4a13ad'" | Remove-WmiObject

    And then run the first script but the two packages still appears as to be removed...

    Thanks,
    Dom

    0 comments No comments

  4. Duchemin, Dominique 2,006 Reputation points
    2021-10-15T23:48:27.92+00:00

    Hello,

    I ran:
    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib"

    there are 516 packages listed

    But there is no package with a name where we have "UCP00128" so I could not run this command !!!
    gwmi -Namespace root\sccmdp -Query "select * from SMS_PackagesInContLib where PackageID ='UCP00128.3e4a13ad'"| Remove-WmiObject

    I tried also ='UCP00128' but there is nothing with this name in the list...
    It seems the two names in the WMI are names used during the build of the package and not the final names... as they have the same root UCP00128 but different extensions...

    Also there is no package with this name in the console:
    141011-2021-10-15-16-52-06-package-to-be-deleted-01.png

    1) Get-ChildItem F:\SCCMContentLib\PkgLib*.ini | out-file dir.txt

    2) Get-WmiObject -namespace root\sccmdp -class SMS_PackagesInContLib | format-list -Property PackageID | out-file wmi.txt

    Nothing with the name UCP00128 ???
    but still having all these errors on the distribution points ...
    "Failed to retrieve the package list on the distribution point. Or the package list in content library doesn't match the one in WMI."

    Thanks,
    Dom


  5. Duchemin, Dominique 2,006 Reputation points
    2021-10-20T17:19:35.29+00:00

    Hello,

    The package UCP00128 should not be there anymore, what should be done to clear the SMS_PackagesInContLib?
    But don't forget the items shown in difference does not reflect the package itself but most likely temporary files with extensions..,
    UCP00128.3e4a13ad
    UCP00128.3e4a61cd

    I checked Administration\Overview\Distribution Points. Right-click the distribution point server and select Properties. Go to Content tab, the package UCP00128 does not exist on any Distribution Points.

    Thanks,
    Dom

    0 comments No comments