Close Menu
    Facebook X (Twitter) Instagram
    Saturday, October 11
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»configmgr»How to fix duplicate reports with double underscore (__) in Configuration Manager

    How to fix duplicate reports with double underscore (__) in Configuration Manager

    Eswar KonetiBy Eswar KonetiJuly 26, 3:17 pm4 Mins Read configmgr 3,291 Views
    Share
    Facebook Twitter LinkedIn Reddit

    The other day, I was running the ConfigMgr reports in my lab, especially the asset intelligence reports for some hardware information.

    I tried to run the first report __ Hardware 01A – Summary of computers in a specific collection, it did not run successfully.

    The following is the error code.

    The report server cannot process the report or shared dataset. The shared data source 'AutoGen__5C6358F2_4BB6_4a1b_A16E_8D96795D8602_' for the report server or SharePoint site is not valid. Browse to the server or site and select a shared data source. (rsInvalidDataSourceReference)

    image

    Based on the error code, the issue could be related to the shared data source. So when I checked data source properties for the report, it has no value configured in it.

    The shared data source reference is no longer valid.

    image

    To fix this, click on the select a shared data source, select {5C6358F2-xxx}, click on Ok.

    2021-07-23_22h33_24

    Run the report now, it works fine.

    image

    Likewise, I run another report, it also had the same issue. This report also starts with a double underscore (__)

    So I have searched with the first report to see if any duplicates. I got 2 entries.

    2021-07-23_22h34_21

    clip_image002

    Based on this, I figured out, the reports with a double underscore (__) are duplicates of the original and might have happened during the upgrade of the Configuration manager site (2103).

    Since the configuration site in my lab was upgraded to 2013 followed by the latest hotfix a few months ago, the logs are overwritten hence cannot find the root cause.

    For now, I will need to figure out, how many reports are duplicated with a double underscore (__) and get rid of them (delete them).

    The following is the SQL query for it.

    Use ReportServer;
    Select ItemID,Path,Name,ParentID,Type,Description,Hidden,CreatedByID,CreationDate,ModifiedByID,ModifiedDate,Parameter 
    FROM dbo.Catalog
     WHERE Type = 2
     and name like '[__]%'
     Order by Name

    image

    The following is the SQL query to get a list of reports without double underscore (__).

    Use ReportServer;
    Select ItemID,Path,Name,ParentID,Type,Description,Hidden,CreatedByID,CreationDate,ModifiedByID,ModifiedDate,Parameter 
     FROM dbo.Catalog
     WHERE Type = 2
     and name not like '[__]%'
     Order by Name

    Before we take delete action, we can do a quick comparison (VLOOKUP/excel) to confirm these __ reports are duplicated or not.

    There are about 250+ reports which have the same symptoms and these can be deleted.

    Now, how do we remove these duplicate reports? Deleting one by one by going to each category based on the SQL data?

    We can make sure of the PowerShell script to delete these reports in one go.

    The following is the PowerShell script from the Technet forum.

    #######################################################################################################################
    # SCCM2012SP1-RemoveDuplicateSSRSReports.ps1
    # This script will connect to SSRS on a specified server and delete all reports that begin with a double underscore
    # Used for SSRS cleanup after SCCM 2012 SP1 installation
    # Script must be run from an account that has access to modify the SSRS instance
    # 2/15/2013 - Mike Laughlin
    #
    # Resources used in writing this script:
    # Starting point: http://stackoverflow.com/questions/9178685/change-datasource-of-ssrs-report-with-powershell
    # API Documentation: http://msdn.microsoft.com/en-us/library/ms165967%28v=sql.90%29.aspx
    #######################################################################################################################
    
    # Define variables
    	$SiteCode = ""
    	$serverName = ""
    
    # Set the value of $noConfirm to $True only if you don't want to manually confirm report deletion. Use with caution.
    	$noConfirm = $False
    
    # Safeguard	
    	If ( $SiteCode -eq "" -or $serverName -eq "" ) { Write-Host "Enter the required information for the SiteCode and serverName variables before running this script." -ForegroundColor Red -BackgroundColor Black ; Exit }
    
    # Connect to SSRS
    	$ssrs = New-WebServiceProxy -uri http://$serverName/ReportServer/ReportService2005.asmx?WSDL -UseDefaultCredential
    
    # Get a listing of all reports in SSRS
    	$reportFolder = "/ConfigMgr_" + $SiteCode
    	$reports = $ssrs.ListChildren($reportFolder, $True)
    	
    # Find all reports starting with double underscores
    	$reportsToDelete = $reports | Where { $_.Name.Substring(0,2) -eq "__" }
    	
    # Quit if no reports are found
    	If ( $reportsToDelete.Count -eq 0 ) { Write-Host "No reports found. Quitting." ; Exit }
    	
    # Show a listing of the reports that will be deleted
    	Write-Host "The following reports will be deleted from SSRS on" $serverName":`n"
    	$reportsToDelete.Name
    	Write-Host "`nTotal number of reports to delete:" $reportsToDelete.Count "`n"
    	
    # Get confirmation before deleting if $noConfirm has not been changed
    	If ( $noConfirm -eq $False ) 
    	{ 
    		$userConfirmation = Read-Host "Delete these reports from" $serverName"? Enter Y or N"
    		If ( $userConfirmation.ToUpper() -ne "Y" ) { Write-Host "Quitting, reports have not been deleted." ; Exit }
    	}
    	
    # Delete the reports
    	$deletedReportCount = 0
    	
    	Write-Host "Beginning to delete reports now. Please wait."
    	ForEach ( $report in $reportsToDelete ) { $ssrs.DeleteItem($report.Path) ; $deletedReportCount++ } 
    	Write-Host "Reports have been deleted. Total number of deleted reports:" $deletedReportCount

    Hope this helps!

    __ AutoGen__5C6358F2_4BB6_4a1b_A16E_8D96795D8602 configmgr double underscore duplicate endpoint manager MEMCM Reports SCCM Shared Data source SSRS The report server cannot process the report or shared dataset
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    2 Comments

    1. sebus on October 10, 2022 7:00 PM

      OPS! If somebody did blindly follow, they would be in trouble because the first SQL query should NOT NOT NOT include not in "...and name not like '[__]%' Order by Name..."

      It must be:

      and name like '[__]%' Order by Name

      Reply
      • Eswar Koneti on October 16, 2022 8:21 PM

        Thanks for the correction. I have updated the blogpost with removal of NOT in the 1st query.

        Regards,
        Eswar

        Reply

    Leave a ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.