其他分享
首页 > 其他分享> > 【备忘】修复SCCM客户端

【备忘】修复SCCM客户端

作者:互联网

1. 把相关修复文件复制到有问题的电脑的本地硬盘,比如C:\Temp

2. 运行 Uninstall.cmd

@rem Stop all SCCM Processes
net stop ccmexec
taskkill /F /FI "SERVICES eq ccmexec"
taskkill /F /IM ccmexec.exe
taskkill /F /IM ccmeval.exe
taskkill /F /IM ccmsetup.exe
taskkill /F /IM ccmrepair.exe
taskkill /F /IM CmRcService.exe
taskkill /F /IM SCNotification.exe
taskkill /F /IM msiexec.exe
taskkill /F /IM ccmrestart.exe
taskkill /F /IM Ccm32BitLauncher

@rem Set WMI to run in standalonehost
C:\Windows\System32\wbem\WinMgmt.exe /standalonehost

@rem Set the Windows Modules Installer service to manual start
sc config TrustedInstaller start= demand

@rem Make sure C:\Windows\Installer exists
md C:\Windows\Installer

%~dp0ccmsetup.exe /uninstall

@rem Delete .SDF and .SQLCE files
del /q C:\Windows\CCM\*.sdf
del /q C:\Windows\CCM\*.sqlce

@rem Uninstall Silverlight
@rem %SystemRoot%\System32\wbem\WMIC.exe product where caption='Microsoft Silverlight' call uninstall

@rem Kill any BITS transfers that might be in error.
%~dp0tools\PsExec.exe -s -accepteula bitsadmin.exe /reset /ALLUSERS

@rem delete SMS certificates
%~dp0tools\ccmdelcert.exe
PowerShell.exe -NoProfile -Command "Get-ChildItem Cert:\LocalMachine\SMS | Where-Object {$_.FriendlyName -like 'SMS*' } | Remove-Item"
%~dp0tools\setacl.exe -on "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\19*" -ot file -rec cont_obj -actn ace -ace "n:administrators;m:grant;p:full"
PowerShell.exe -NoProfile -Command "Get-ChildItem -Path 'C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\' | Where-Object {$_.Name -like '19*' } | Remove-Item -Force"

If exist c:\Windows\SMSCFG.INI del /q c:\Windows\SMSCFG.INI

@Rem Delete Client Registry Keys
REG DELETE HKLM\SOFTWARE\Microsoft\CCMSetup /f
REG DELETE HKLM\SOFTWARE\Microsoft\SMS /f
REG DELETE HKLM\SOFTWARE\Wow6432Node\Microsoft\CCM /f
REG DELETE HKLM\SOFTWARE\Wow6432Node\Microsoft\CCMSetup /f
REG DELETE HKLM\SOFTWARE\Wow6432Node\Microsoft\SMS /f

C:\Windows\System32\takeown.exe /f C:\Windows\CCM\* /R /A
C:\Windows\System32\takeown.exe /f C:\Windows\ccmsetup\* /R /A
%~dp0tools\setacl.exe -on "C:\Windows\CCM\*" -ot file -rec cont_obj -actn ace -ace "n:administrators;m:grant;p:full"
%~dp0tools\setacl.exe -on "C:\Windows\ccmsetup\*" -ot file -rec cont_obj -actn ace -ace "n:administrators;m:grant;p:full"

pause

3. 运行 C:\Temp\Client\tools\ccmclean.exe

4. 删除所以CCM开头的文件夹。

5. In case, if a folder is stuck and can’t be removed run the following:

sc queryex winmgmt

taskkill /f /pid  <<上一个命令得到的 PID >>

6.  检查确认 C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\ 目录里,开头是19*的 "RSA-MachineKey" 已经被删除掉。如果还存在,就手动删除掉。

7. 运行 C:\Temp\Client\Install.cmd

@rem Stop all SCCM Processes
net stop ccmexec
taskkill /F /FI "SERVICES eq ccmexec"
taskkill /F /IM ccmexec.exe
taskkill /F /IM ccmeval.exe
taskkill /F /IM ccmsetup.exe
taskkill /F /IM ccmrepair.exe
taskkill /F /IM CmRcService.exe
taskkill /F /IM SCNotification.exe
taskkill /F /IM msiexec.exe
taskkill /F /IM ccmrestart.exe
taskkill /F /IM Ccm32BitLauncher

@rem Set WMI to run in standalonehost
C:\Windows\System32\wbem\WinMgmt.exe /standalonehost

@rem Set the Windows Update service to run with shared memory
sc config wuauserv type= share

@rem Set the Windows Modules Installer service to manual start
sc config TrustedInstaller start= demand

@rem Set the Windows Firewall service to auto start
sc config MpsSvc start= auto
sc start MpsSvc

@rem Make sure C:\Windows\Installer exists
md C:\Windows\Installer

@rem Solution to "The system administrator has set policies to prevent this installation"
Reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer" /v DisableMSI /d 0 /t REG_DWORD /f

@rem Set DNS negative caching back to MS default
reg.exe delete HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters /v MaxNegativeCacheTtl /f

@rem Delete the contents of C:\Windows\SoftwareDistribution
Net stop wuauserv
powershell.exe -NoProfile -command "Get-ChildItem -Path 'C:\Windows\SoftwareDistribution\' -Recurse | Foreach-object {Remove-item -Recurse -path $_.FullName -Force }"
powershell.exe -NoProfile -command "Get-ChildItem -Path 'C:\Windows\System32\GroupPolicy\' -Recurse | Foreach-object {Remove-item -Recurse -path $_.FullName -Force }"
Net start wuauserv

@rem Uninstall the SCCM client if installed
%~dp0ccmsetup.exe /uninstall

@rem Delete .SDF and .SQLCE files
del /q C:\Windows\CCM\*.sdf
del /q C:\Windows\CCM\*.sqlce

@rem Uninstall Silverlight
@rem %SystemRoot%\System32\wbem\WMIC.exe product where caption='Microsoft Silverlight' call uninstall

@rem Kill any BITS transfers that might be in error.
%~dp0tools\PsExec.exe -s -accepteula bitsadmin.exe /reset /ALLUSERS

@rem delete certificate file
%~dp0tools\ccmdelcert.exe
PowerShell.exe -NoProfile -Command "Get-ChildItem Cert:\LocalMachine\SMS | Where-Object {$_.FriendlyName -like 'SMS*' } | Remove-Item"
%~dp0tools\setacl.exe -on "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys" -ot file -rec cont_obj -actn ace -ace "n:system;m:grant;p:full"
%~dp0tools\setacl.exe -on "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\19*" -ot file -rec cont_obj -actn ace -ace "n:administrators;m:grant;p:full"
PowerShell.exe -NoProfile -Command "Get-ChildItem -Path 'C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\' | Where-Object {$_.Name -like '19*' } | Remove-Item -Force"

If exist c:\Windows\SMSCFG.INI del /q c:\Windows\SMSCFG.INI

@rem Install Visual C++ 2013 Runtime
%~dp0x64\vcredist_x64.exe /install /quiet /norestart
%~dp0i386\vcredist_x86.exe /install /quiet /norestart

%~dp0ccmsetup.exe /source:%~dp0 /noservice /skipprereq:silverlight.exe SMSSITECODE=《站点代号》 FSP=《FSP地址》 DNSSUFFIX=《DNS后缀》 SMSMP=《MP的地址》 RESETKEYINFORMATION=TRUE

@Rem Set SCCM Client work hours
%SystemRoot%\system32\cscript.exe %~dp0Tools\Client_Work_Hours_Set_to_No_Days.vbs

8. 在控制面板里运行 “Configuration Manager” 

9. 运行 Actions 标签里的所以 Action:

标签:exe,Windows,SCCM,备忘,IM,rem,taskkill,Microsoft,客户端
来源: https://blog.csdn.net/aladinggao/article/details/120437056