topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.99k stars 136 forks source link

Windows Update fails with Win32 internal error #867

Closed BobG1983 closed 2 months ago

BobG1983 commented 3 months ago

Erroneous Behavior

Running topgrade on Windows 11 with PSWindowsUpdate installed returns an error:

── 11:18:21 - Windows Update ───────────────────────────────────────────────────
Start-Process : A positional parameter cannot be found that accepts argument 'PSWindowsUpdate'.
At line:1 char:1
+ Start-Process powershell -Verb runAs -ArgumentList  Import-Module PSW ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

The Win32 internal error "The handle is invalid" 0x6 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.

Windows update failed:
   0: Command failed: `D:\scoop\shims\sudo.cmd 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoProfile -Command 'Start-Process powershell -Verb runAs -ArgumentList '\''Import-Module PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose'\'''`
   1: `D:\scoop\shims\sudo.cmd` failed: exit code: 1

Location:
   src\steps\powershell.rs:122

Expected Behavior

Windows update should run

Steps to reproduce

I don't really know. All I did was cargo binstall topgrade, install PSWindowsUpdate as follows:

Install-Module -Name PSWindowsUpdate -Force
Get-Package -Name PSWindowsUpdate

Problem persists without calling from topgrade

Did you run topgrade through Remote Execution

Additional Details

Verbose Output (topgrade -v)

── 11:24:43 - Windows Update ───────────────────────────────────────────────────
DEBUG Executing command `C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Command 'Get-Module -ListAvailable PSWindowsUpdate'`
DEBUG Executing command `D:\scoop\shims\sudo.cmd 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoProfile -Command 'Start-Process powershell -Verb runAs -ArgumentList '\''Import-Module PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose'\'''`
Start-Process : A positional parameter cannot be found that accepts argument 'PSWindowsUpdate'.
At line:1 char:1
+ Start-Process powershell -Verb runAs -ArgumentList  Import-Module PSW ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

The Win32 internal error "The handle is invalid" 0x6 occurred while getting console output buffer information. Contact Microsoft Customer Support Services.

DEBUG Command failed: Err(
   0: Command failed: `D:\scoop\shims\sudo.cmd 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoProfile -Command 'Start-Process powershell -Verb runAs -ArgumentList '\''Import-Module PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose'\'''`
   1: `D:\scoop\shims\sudo.cmd` failed: exit code: 1

Location:
   src\steps\powershell.rs:122)
DEBUG Step "Windows update" failed:
   0: Command failed: `D:\scoop\shims\sudo.cmd 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoProfile -Command 'Start-Process powershell -Verb runAs -ArgumentList '\''Import-Module PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose'\'''`
   1: `D:\scoop\shims\sudo.cmd` failed: exit code: 1

Location:
   src\steps\powershell.rs:122
Windows update failed:
   0: Command failed: `D:\scoop\shims\sudo.cmd 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoProfile -Command 'Start-Process powershell -Verb runAs -ArgumentList '\''Import-Module PSWindowsUpdate; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -Verbose'\'''`
   1: `D:\scoop\shims\sudo.cmd` failed: exit code: 1

Location:
   src\steps\powershell.rs:122
niStee commented 2 months ago

842