Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

Commit

Permalink
Make the new stop service with wildcard not error
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbera authored Nov 29, 2017
1 parent 695a637 commit b0788de
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function StartStopServices(
[PSCustomObject[]] $presentServicesArray
$servicesNamesArray | ForEach-Object {
$serviceName = $_
$matchingServices = Get-Service -Name $serviceName
$matchingServices = Get-Service -Name $serviceName -ErrorAction SilentlyContinue

if ($matchingServices -eq $null)
{
Expand Down Expand Up @@ -58,4 +58,4 @@ function StartStopServices(
{
$presentServicesArray | % { Set-Service -Name $_.Name -StartupType $startupType }
}
}
}

0 comments on commit b0788de

Please sign in to comment.