简体   繁体   English

在Powershell中使用包含启动服务

[英]Start services with contain in powershell

I need a Powershell Script which start all my services 'example*' without the services reeded in from a .txt file 我需要一个Powershell脚本来启动所有服务“ example *”,而无需从.txt文件中删除服务

(sry, my English sucks I know) (对不起,我的英语很烂,我知道)

您可以执行以下操作:

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

Something like this maybe: 可能是这样的:

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

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

相关问题 Powershell - 启动有序的服务序列 - Powershell - Start ordered sequence of services PowerShell:启动服务和相关服务 - PowerShell: Start service and dependent services Powershell停止服务,清理磁盘,然后启动服务 - Powershell Stop Services, defrg disks and then start services powershell:更改 windows 7 机器上的服务启动类型 - powershell: Changing start type of services on a windows 7 machine Powershell 显示所有已停止的自动服务并尝试启动这些服务 - Powershell to display all automatic services that are stopped and attempt to start those services PowerShell-仅在所有服务均已停止的情况下启动rocopy - PowerShell - Start rocopy only if all services have stopped Powershell 脚本检查多台远程机器上的服务并在它们未运行时启动它们 - Powershell script to checking services on multiple remote machines and to start them if they are not running Powershell字符串不包含 - Powershell string does not contain 使用Powershell脚本或其他方式发布后如何启动Web服务 - How to kick start web services after publishing using powershell script or any other way 使用内联管理员凭据运行 Powershell 脚本来启动和停止 Windows 服务 - Running Powershell script using inline admin credentials to start and stop windows services
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM