diff --git a/scripts/Common/Scripts/Operations.ps1 b/scripts/Common/Scripts/Operations.ps1 index 23acbdf4..b983f7f3 100644 --- a/scripts/Common/Scripts/Operations.ps1 +++ b/scripts/Common/Scripts/Operations.ps1 @@ -29,13 +29,18 @@ $null = New-Module { function Start-Operation { param( - [switch] $NonInteractive = ($null -ne (Get-OneShotTask)), + [switch] $NonInteractive, [switch] $NoImplicitCleanup, [scriptblock] $Action ) $cleanup = { }; + if ($IsWindows -and ($null -ne (Get-OneShotTask))) { + $taskPending = $true; + [switch] $NonInteractive = $true; + } + if (-not $Global:InOperation) { if ($env:DEBUG) { Set-PSDebug -Trace 1; @@ -231,7 +236,7 @@ $null = New-Module { } } - if ((Get-OneShotTask)) { + if ($taskPending) { Start-OneShot; } else { & $Action;