Inital commit.

This commit is contained in:
2019-11-11 19:22:39 -05:00
parent f89d330f14
commit a052b43b22
80 changed files with 5989 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
param(
[Int32]$Wait=0,
[Parameter(Mandatory=$true)]
[string]$Services
)
## Wait for the specified amount of time before proceeding
if ( $Wait -gt 0 ) { Start-Sleep -Seconds $Wait }
##Split the list of services so we can process each one
$Services.Split(",") | ForEach {
## Get the service's status
$service = $_
$status = (Get-Service -Name $service -ErrorAction SilentlyContinue).Status
## Make sure the service exists
if ($status) {
## Make sure the service isn't currently running
if ($status -ne "Running") {
## Try to restart the service
Write-Host "Restarting ${service}"
try { Restart-Service -Name $service -Force -ErrorAction Stop }
## Write any errors to the host
catch { Write-Host $_ }
} else { Write-Host "${service} is already running" }
} else { Write-Host "${service} does not exist" }
}