Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Mods function to stop service #589

Merged
merged 5 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Sources/WAU/Winget-AutoUpdate/mods/_AppID-template.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ $RunWait = $True
#Beginning of Process Name to Stop - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
$Proc = @("")

#Beginning of Service Name to Stop - multiple: "service1.exe","service2.exe"
$Svc = @("")

#Beginning of Process Name to Wait for to End - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
$Wait = @("")

Expand Down Expand Up @@ -89,6 +92,9 @@ if ($RunSystem) {
if ($Proc) {
Stop-ModsProc $Proc
}
if ($Svc) {
Stop-ModsSvc $Svc
}
if ($Wait) {
Wait-ModsProc $Wait
}
Expand Down Expand Up @@ -129,4 +135,4 @@ if ($RunUser) {
Invoke-ModsApp $RunUser "" "" $User
}

<# EXTRAS #>
<# EXTRAS #>
6 changes: 6 additions & 0 deletions Sources/WAU/Winget-AutoUpdate/mods/_Mods-Functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ function Stop-ModsProc ($Proc) {
}
Return
}
function Stop-ModsSvc ($Svc) {
foreach ($service in $Svc) {
Stop-Service -Name $service -Force -ErrorAction SilentlyContinue | Out-Null
}
Return
}

function Wait-ModsProc ($Wait) {
foreach ($process in $Wait) {
Expand Down
Loading