feat: add function to stop service
parent
d5e5d89afb
commit
f5613f6cf9
|
@ -10,6 +10,9 @@ $RunWait = $True
|
||||||
#Beginning of Process Name to Stop - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
#Beginning of Process Name to Stop - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
||||||
$Proc = @("")
|
$Proc = @("")
|
||||||
|
|
||||||
|
#Beginning of Service Name to Stop - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
||||||
|
$Svc = @("")
|
||||||
|
|
||||||
#Beginning of Process Name to Wait for to End - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
#Beginning of Process Name to Wait for to End - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
||||||
$Wait = @("")
|
$Wait = @("")
|
||||||
|
|
||||||
|
@ -89,6 +92,9 @@ if ($RunSystem) {
|
||||||
if ($Proc) {
|
if ($Proc) {
|
||||||
Stop-ModsProc $Proc
|
Stop-ModsProc $Proc
|
||||||
}
|
}
|
||||||
|
if ($Svc) {
|
||||||
|
Stop-ModsProc $Svc
|
||||||
|
}
|
||||||
if ($Wait) {
|
if ($Wait) {
|
||||||
Wait-ModsProc $Wait
|
Wait-ModsProc $Wait
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,12 @@ function Stop-ModsProc ($Proc) {
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
function Stop-ModsSvc ($Svc) {
|
||||||
|
foreach ($service in $Svc) {
|
||||||
|
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
}
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
function Wait-ModsProc ($Wait) {
|
function Wait-ModsProc ($Wait) {
|
||||||
foreach ($process in $Wait) {
|
foreach ($process in $Wait) {
|
||||||
|
|
Loading…
Reference in New Issue