* Uninstall old SCCM Client

C:\Windows\ccmsetup\ .\ccmsetup.exe /uninstall

* Clean CCM WMI

Get-WmiObject -Namespace “root” -Query “SELECT * FROM __Namespace where name= ‘ccm'” | Remove-WmiObject

* Uninstalled Reporting Services Point Role from SCCM 2012 R2

* Ran the script by (Mike Laughlin) after editing “SiteCode” & “Server Name” to clean up OLD files leaving only the ConfigMgr_”SiteCode” folder

######################################################################################################################################

# SCCM2012SP1-RemoveDuplicateSSRSFolders.ps1

# This script will connect to SSRS on a specified server and delete all folders that end with .OLD.*

# Used for SSRS cleanup after SCCM 2012 SP1 installation

# Script must be run from an account that has access to modify the SSRS instance

# 3/22/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

# Previous script: http://social.technet.microsoft.com/Forums/en-US/configmanagergeneral/thread/dc9aa3b4-cea9-4a07-87ca-2795a2dbc04e

######################################################################################################################################

# Define variables

$SiteCode = “XXX”

$serverName = “SACCESQLXXX.XXX.local”

# Set the value of $noConfirm to $True only if you don’t want to manually confirm folder 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

$ssrs = New-WebServiceProxy -uri http://sccmreportsacc.XXX.local/ReportServer_INS008/ReportService2005.asmx?WSDL -UseDefaultCredential

# Get a listing of all folders in SSRS

$reportFolders = $ssrs.ListChildren(“/”, $True)

# Find all folders containing .OLD.*

$foldersToDelete = $reportFolders | Where { $_.Name -like “ConfigMgr_” + $SiteCode + “.OLD.*”}

# Quit if no folders are found

If ( $foldersToDelete.Count -eq 0 ) { Write-Host “No folders with .OLD.* found. Quitting.” ; Exit }

# Show a listing of the folders that will be deleted

Write-Host “The following folders will be deleted from SSRS on” $serverName”:`n”

$foldersToDelete.Name

Write-Host “`nTotal number of folders to delete:” $foldersToDelete.Count “`n”

# Get confirmation before deleting if $noConfirm has not been changed

If ( $noConfirm -eq $False )

{

$userConfirmation = Read-Host “Delete these folders from” $serverName”? Enter Y or N”

If ( $userConfirmation.ToUpper() -ne “Y” ) { Write-Host “Quitting, folders have not been deleted.” ; Exit }

}

# Delete the folders

$deletedFolderCount = 0

Write-Host “Beginning to delete folders now. Please wait.”

ForEach ( $folder in $foldersToDelete ) { $ssrs.DeleteItem($folder.Path) ; $deletedFolderCount++ }

Write-Host “Folders have been deleted. Total number of deleted folders:” $deletedFolderCount

######################################################################################################################################

* Run mofcomp to add classes to wmi

PS C:\Users\XXX> mofcomp “C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof”

Microsoft (R) MOF Compiler Version 6.2.9200.16398

Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.

Parsing MOF file: C:\Program Files (x86)\Microsoft SQL Server\100\Shared\sqlmgmproviderxpsp2up.mof

MOF file has been successfully parsed

Storing data in the repository…

Done!‚Äč

* Reinstalled Reporting Services Point Role

https://social.technet.microsoft.com/Forums/en-US/f6ce1fc4-fd60-4908-a308-751b2f856211/sccm-2012-sp1-evil-folders-in-reporting-services-what-are-they-and-how-to-remove-them?forum=configmanagergeneral