繁体   English   中英

在Powershell中使用包含启动服务

[英]Start services with contain in powershell

我需要一个Powershell脚本来启动所有服务“ example *”,而无需从.txt文件中删除服务

(对不起,我的英语很烂,我知道)

您可以执行以下操作:

Get-Service -Name * -ComputerName PCNameHere | Where {$_.Name -like "example*"} | Restart-Service -Force -Verbose

可能是这样的:

$restrictedServices = @(Get-Content X:\restricted.txt) -join '|'
Get-Service example* | ?{$_.Name -notmatch $restrictedServices} | Start-Service -PassThru

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM