SCCM 2012 WMI & ContentLib missmatch - Get-InvalidPKG

Connects first to WMI on every DP and gets packages from there. Then checks if remote registry is running and connects to remote registry to get the content library path. It compares the two results and checks for mismatches.

4.7 Star
4,129 times
Add to favorites
System Center
E-mail Twitter Digg Facebook
Sign in to ask a question

  • Finally, a content library tool that works!
    1 Posts | Last post March 28, 2018
    • This is the first script I've found after months of searching that actually fixes the issues ("Failed to retrieve package list on the distribution point Or the package list in content library doesn't match the one in WMI).  If it didn't fix it, it pointed me to the answer in the logs.  I now have 28 remote distribution points around the globe with green check-marks and a status of SUCCESS!!  Thanks so much!
  • Not a question but a comment.
    2 Posts | Last post January 03, 2018
    • The script was failing at line 457 for me because it was unable to open the subkey "SOFTWARE\Microsoft\SMS\DP". I discovered that $RemoteRegistry.OpenSubKey("SOFTWARE\Microsoft") worked and only contained 112 subkeys, instead of 136 seen by Regedit; "SMS" was one that was missing. Upon further research, I discovered this was an x86/x64 issue, which was resolved by modifying line 456 to explicitly open the registry as x64.
      Modified Line: 
      $RemoteRegistry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LOCALMACHINE',$Computer,"Registry64") 
    • Thank you for this information.
      I will adapt the script as soon as there is some time.
  • ExportCSV not working?
    2 Posts | Last post September 21, 2015
    • I am trying to get the script to dump info into a CSV file. The XML dump works, but for the CSV, this is all I get:
      Any suggestions?
    • Hey,
      thanks for your feedback.
      I found the issue and resolved it in version 1.6.
  • Curious about the errors..
    2 Posts | Last post October 29, 2014
    • Hey Maddin, thanks for your contribution.  Unfortunately on any DP I try it on I get this error.  Any idea how I could get it to work?  Seems like it would be very handy.
      Export-Clixml : Cannot bind argument to parameter 'LiteralPath' because it is an empty string.
      At C:\Get-InvalidPKG.ps1:484 char:69
      +             Else{Export-Clixml -InputObject $DPListObj -LiteralPath $ExportCliXM ...
      +                                                                     ~~~~~~~~~~~~
          + CategoryInfo          : InvalidData: (:) [Export-Clixml], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Expo
      Export-Csv : Cannot validate argument on parameter 'LiteralPath'. The argument is null or empty. Provide an argument
      that is not null or empty, and then try the command again.
      At C:\Get-InvalidPKG.ps1:501 char:79
      +             Else{Export-Csv -InputObject $CSVList -Delimiter ',' -LiteralPath $E ...
      +                                                                               ~~
          + CategoryInfo          : InvalidData: (:) [Export-Csv], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ExportCsvCommand
    • Hey SCMSJOE,
      thank you for reply.
      Yes I found this error already and will fix it when I have time.
      Does not depend on your environment :)
      It just happens if you do not specify parameter -ExportXML and -ExportCSV.
      Truly I forgot to add a test if the two variables $ExportCliXML and $ExportCSV -eq $null.
      Small issue with no affect outside of the logfile.