~sporiff/ccm-removal

64f80b4a54948221d4019ad17a78bf7577239796 — Ciarán Ainsworth 1 year, 10 months ago 1dadd66
Revert "Add Script and Readme"

This reverts commit 1dadd6632fd3e14b1d2cddc0b0fe8fdd52406128.
2 files changed, 0 insertions(+), 54 deletions(-)

D CCM-Removal.ps1
D Readme.md.txt
D CCM-Removal.ps1 => CCM-Removal.ps1 +0 -53
@@ 1,53 0,0 @@
Start-Process -FilePath 'C:\Windows\ccmsetup\ccmsetup.exe' -Args "/uninstall" -Wait -NoNewWindow

# wait for exit
$CCMProcess = Get-Process ccmsetup -ErrorAction SilentlyContinue
try{
    $CCMProcess.WaitForExit()
}catch{

}

# Stop Services
Stop-Service -Name ccmsetup -Force -ErrorAction SilentlyContinue
Stop-Service -Name CcmExec -Force -ErrorAction SilentlyContinue
Stop-Service -Name smstsmgr -Force -ErrorAction SilentlyContinue
Stop-Service -Name CmRcService -Force -ErrorAction SilentlyContinue

# wait for exit
$CCMProcess = Get-Process ccmexec -ErrorAction SilentlyContinue
try{
    $CCMProcess.WaitForExit()
}catch{

}

# Remove WMI Namespaces
Get-WmiObject -Query "SELECT * FROM __Namespace WHERE Name='ccm'" -Namespace root | Remove-WmiObject
Get-WmiObject -Query "SELECT * FROM __Namespace WHERE Name='sms'" -Namespace root\cimv2 | Remove-WmiObject

# Remove Services from Registry
$MyPath = “HKLM:\SYSTEM\CurrentControlSet\Services”
Remove-Item -Path $MyPath\CCMSetup -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\CcmExec -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\smstsmgr -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\CmRcService -Force -Recurse -ErrorAction SilentlyContinue

# Remove SCCM Client from Registry
$MyPath = “HKLM:\SOFTWARE\Microsoft”
Remove-Item -Path $MyPath\CCM -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\CCMSetup -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\SMS -Force -Recurse -ErrorAction SilentlyContinue

# Remove Folders and Files
$MyPath = $env:WinDir
Remove-Item -Path $MyPath\CCM -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\ccmsetup -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\ccmcache -Force -Recurse -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\SMSCFG.ini -Force -ErrorAction SilentlyContinue
Remove-Item -Path $MyPath\SMS*.mif -Force -ErrorAction SilentlyContinue	
Remove-Item -Path $MyPath\SMS*.mif -Force -ErrorAction SilentlyContinue	

#Remove authority from CCM
$MyPath = “HKLM:\SOFTWARE\Microsoft”
Remove-Item -Path $MyPath\DeviceManageabilityCSP -Force -Recurse -ErrorAction SilentlyContinue
\ No newline at end of file

D Readme.md.txt => Readme.md.txt +0 -1
@@ 1,1 0,0 @@
A short PowerShell script for removing all traces of the CCM client. This is to be run as an SMSTSPostAction within an SCCM task sequence as a means to grant authority to an MDM provider after a successful build.
\ No newline at end of file