diff --git a/functions/private/Invoke-WinUtilTweaks.ps1 b/functions/private/Invoke-WinUtilTweaks.ps1 index 8bb06faf..dd6a1b8f 100644 --- a/functions/private/Invoke-WinUtilTweaks.ps1 +++ b/functions/private/Invoke-WinUtilTweaks.ps1 @@ -59,8 +59,8 @@ function Invoke-WinUtilTweaks { Write-Debug "Service $($service.Name) was changed in the past to $($service.StartType.ToString()) from it's original type of $($psitem.$($values.OriginalService)), will not change it to $($psitem.$($values.service))" $changeservice = $false } - } catch [System.ServiceProcess.ServiceNotFoundException] { - Write-Warning "Service $($psitem.Name) was not found" + } catch { + # do nothing } } diff --git a/functions/private/Set-WinUtilService.ps1 b/functions/private/Set-WinUtilService.ps1 index d2a7d459..c1a02f4f 100644 --- a/functions/private/Set-WinUtilService.ps1 +++ b/functions/private/Set-WinUtilService.ps1 @@ -26,11 +26,7 @@ Function Set-WinUtilService { # Service exists, proceed with changing properties $service | Set-Service -StartupType $StartupType -ErrorAction Stop - } catch [System.ServiceProcess.ServiceNotFoundException] { - Write-Warning "Service $Name was not found" } catch { - Write-Warning "Unable to set $Name due to unhandled exception" - Write-Warning $_.Exception.Message + # do nothing } - } diff --git a/functions/public/Invoke-WPFRunspace.ps1 b/functions/public/Invoke-WPFRunspace.ps1 index dfba2931..0205365b 100644 --- a/functions/public/Invoke-WPFRunspace.ps1 +++ b/functions/public/Invoke-WPFRunspace.ps1 @@ -22,13 +22,14 @@ function Invoke-WPFRunspace { Param ( $ScriptBlock, $ArgumentList, - $DebugPreference, - $automation + $DebugPreference ) - if ($automation = $true) { + if ($PARAM_RUN) { + write-host "Running in Main Thread" & $ScriptBlock @ArgumentList @DebugPreference } else { + write-host "Running in Runspace" # Create a PowerShell instance $script:powershell = [powershell]::Create()