ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

【备忘】修复SCCM客户端

2021-09-24 15:30:19  阅读:329  来源: 互联网

标签:exe Windows SCCM 备忘 IM rem taskkill Microsoft 客户端


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

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有