Various fixes

This commit is contained in:
Yorick Barbanneau 2018-03-23 15:30:58 +01:00
parent f3829001d4
commit 61b23e2ef3

View file

@ -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
}
}