power shell 命令 启用 服务 禁用服务

在PowerShell中,你可以使用以下命令来替代 DISM /Online /Cleanup-Image /RestoreHealth

powershellCopy Code
Repair-WindowsImage -Online -ScanHealth

这个命令将扫描并修复Windows映像中的任何问题。请确保以管理员身份运行PowerShell以执行这个命令

 

这些命令用于在Windows中启动特定的服务。以下是对每个服务的详细描述:

wuauserv:

描述: Windows Update服务,负责管理和维护Windows操作系统的更新程序。
用途: 该服务负责检查、下载和安装Windows更新,确保系统安全性和稳定性。
cryptSvc:

描述: 加密服务,提供加密和解密功能以支持多种Windows功能和应用程序。
用途: 该服务与加密相关的各种操作,包括加密文件系统、数字证书、安全凭证等。
bits:

描述: 后台智能传输服务,用于将文件从Internet或局域网下载到本地计算机。
用途: BITS服务通常由Windows更新和其他应用程序使用,可以在后台进行文件下载,而不会影响用户正在进行的工作。
msiserver:

描述: Windows Installer服务,负责安装、维护和删除软件包。
用途: 该服务支持Windows安装程序和卸载程序,确保软件包的正确安装和卸载。
通过以上命令,你可以启动这些服务以确保系统的正常运行,并确保相关功能的顺利执行。

CMD
net stop wuauserv
net stop cryptSvc
net stop bits
net stop msiserver

POWERSHELL
Stop-Service -Name wuauserv
Stop-Service -Name cryptSvc
Stop-Service -Name bits
Stop-Service -Name msiserver

CMD
net start wuauserv
net start cryptSvc
net start bits
net start msiserver

powershell
Start-Service -Name wuauserv
Start-Service -Name cryptSvc
Start-Service -Name bits
Start-Service -Name msiserver

CMD
ren C:\Windows\SoftwareDistribution SoftwareDistribution.old
ren C:\Windows\System32\catroot2 catroot2.old

powershell
Rename-Item -Path 'C:\Windows\SoftwareDistribution' -NewName 'SoftwareDistribution.old'
Rename-Item -Path 'C:\Windows\System32\catroot2' -NewName 'catroot2.old'

 

CMD
sfc /scannow


在PowerShell中,你可以使用以下命令来运行系统文件检查器(SFC):

powershell
Start-Process -FilePath 'sfc' -ArgumentList '/scannow' -Wait

CMD
 chkdsk /f /r


在PowerShell中,你可以使用以下命令来执行磁盘检查和修复:

powershell
Repair-Volume -DriveLetter C -Scan -OfflineScanAndFix
这个命令会对C盘进行扫描和修复。请确保以管理员身份运行PowerShell以执行这个命令。

posted @ 2024-02-05 20:58  suv789  阅读(56)  评论(0编辑  收藏  举报