Запуск служб
$strService = "bits" Start-Service -Name $strService
несколько служб -
$aryServices = "bits", "wuauserv", "CcmExec"
foreach ($strService in $aryServices)
{
Write-Host "Starting $strService ..."
Start-Service -Name $strService
}
аккуратный запуск служб -
$strService = "bits"
Get-Service -name $strService |
foreach-object { if ($_.status -ne "running")
{
Write-Host "starting $strService ..."
Start-Service -Name $strService
}
ELSE
{
Write-Host "$strService is already started"
}
}
Голосов пока нет

Оставить комментарий