查看哪些服务依赖某个 Windows 服务
用 PowerShell 的 Get-Service -DependentServices 参数,在停用服务前先看看谁依赖它。
运行 `Get-Service -Name LanmanServer -DependentServices`,即可列出所有依赖该服务的其他服务。
01命令
命令
$ Get-Service -Name LanmanServer -DependentServices | Format-Table Status, Name, DisplayName -AutoSize02作用说明
在禁用或停止某个 Windows 服务之前,最好先知道还有哪些服务靠它运行。Get-Service 的 -DependentServices 参数会列出依赖目标服务的服务。把 LanmanServer 换成任意服务名即可;如果想看该服务自己依赖谁,可改用 -RequiredServices 参数。
03风险
!注意: 停掉被依赖的服务可能导致文件共享、打印或网络登录等功能中断,直到服务重新启动。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-Service (Microsoft.PowerShell.Management)依据: Documents the -DependentServices and -RequiredServices parameters for Get-Service and shows piping results to Format-Table.
- Get-Service — Get the status of Windows services依据: Lists the -DependentServices parameter and examples of querying related services.
最后验证: 2026-09-19 · 分类: 系统与设置