From 61b23e2ef3f689e555527bb59f8a2ea87b86ec93 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Fri, 23 Mar 2018 15:30:58 +0100 Subject: [PATCH] Various fixes --- cleanW10.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cleanW10.ps1 b/cleanW10.ps1 index 78e3556..20370ac 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -106,7 +106,7 @@ function RemoveScheduledTask () { else { $params.path="" } try { $task = Invoke-Expression $command - Write-Host -NoNewline "`tRemove task $($param.name) : " + Write-Host -NoNewline "`tRemove task $($params.name) : " $task | Unregister-ScheduledTask -ErrorAction SilentlyContinue -Confirm:$false Write-Host -ForegroundColor Green "done" } @@ -246,14 +246,14 @@ function UninstallModernApp { } } elseif ( $params.ContainsKey('name') ) { - Write-Host -NoNewLine "`tUninstall $($params.name) :" + Write-Host -NoNewLine "`tUninstall $($params.name) : " try { - Get-AppxPackage -AllUsers | Where-Object { $_.name -like "*$($params.name)*" } | Out-Null + $(Get-AppxPackage -AllUsers | Where-Object { $_.name -like "*$($params.name)*" } | Remove-AppxPackage $pkg) Write-Host -ForegroundColor Green "done" } catch { - Write-Host -NoNewLine -ForegroundColor Red "`tError `n`t" - write-Host -ForegroundColor DarkRed "Impossible to Uninstall, this app sees to be a system one." + Write-Host -NoNewLine -ForegroundColor Red "Error `n`t" + write-Host -ForegroundColor DarkRed "Impossible to Uninstall. Is this a system one." } } else { @@ -369,7 +369,7 @@ function KillProcess { ) Write-Host -NoNewLine "`tKilling $($params.name) : " try { - Stop-Process $(Get-Process $params.name) | Out-Null + Stop-Process $(Get-Process $params.name -ErrorAction SilentlyContinue ) Write-Host -ForegroundColor Green "Done" } catch { @@ -493,10 +493,10 @@ try { Remove-PSDrive -Name HKCR Remove-PSDrive -Name HKCU Remove-PSDrive -Name HKU - reg unload "HKU\Default" | Out-Null + reg unload "HKU\Default" 2>&1 | Out-Null Write-Host -ForegroundColor Green "done" } catch { Write-Host -NoNewline -ForegroundColor Red "Error`n`t" Write-Host -ForegroundColor DarkRed $Error[0].Exception.Message -} \ No newline at end of file +}