[英]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.