Skip to content
Permalink
Browse files

added logic on process message

  • Loading branch information...
wsmelton committed Oct 25, 2019
1 parent 5861daa commit a0fdc0d5f3cf240c2d2701659c15ecc2390367e5
Showing with 7 additions and 5 deletions.
  1. +7 −5 cleanup.ps1
@@ -47,11 +47,13 @@ if ( ($olderVersions.Count -gt 0) -and $newestVersion.Version -in $installedVers
} else {
$processes = Get-Process $process -ErrorAction SilentlyContinue | Where-Object Id -NE $PID
}
if ($Pscmdlet.ShouldProcess("$env:COMPUTERNAME", "Killing $($processes.Count) processes of powershell running")) {
Write-Output "Death to the following process(es): $(($processes.Id) -join ",")"
$processes | Stop-Process -ErrorVariable dangit -ErrorAction SilentlyContinue -Force
if ($dangit) {
Write-Warning "Not able to kill following processes: $((Get-Process $process | Where-Object Id -NE $pid).Id -join ",")"
if ($processes.Count -gt 0) {
if ($Pscmdlet.ShouldProcess("$env:COMPUTERNAME", "Killing $($processes.Count) processes of powershell running")) {
Write-Output "Death to the following process(es): $(($processes.Id) -join ",")"
$processes | Stop-Process -ErrorVariable dangit -ErrorAction SilentlyContinue -Force
if ($dangit) {
Write-Warning "Not able to kill following processes: $((Get-Process $process | Where-Object Id -NE $pid).Id -join ",")"
}
}
}
if ($Pscmdlet.ShouldProcess("$env:COMPUTERNAME", "Removing old versions of $module.")) {

0 comments on commit a0fdc0d

Please sign in to comment.
You can’t perform that action at this time.