Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve Windows Update step and add PSWindowsUpdate Module #842

Merged
merged 6 commits into from
Aug 1, 2024

Conversation

niStee
Copy link
Contributor

@niStee niStee commented Jun 30, 2024

Refactor the windows_update function in windows.rs to improve the Windows Update step. Added a prompt for administrator privileges and updated the warning message. Also, added support for installing the PSWindowsUpdate Module as an alternative to using USOClient for Windows Update.

still see warning:
The installer will request to run as administrator, expect a prompt.
Start-Process : A parameter cannot be found that matches parameter name 'Command'.
At line:1 char:74

  • ... ath powershell -Verb runAs -ArgumentList -NoProfile -Command Import- ...
  •                                                      ~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

VERBOSE: MSI-THIN-GF36 (6/30/2024 4:48:48 PM): Connecting to Microsoft Update server. Please wait...
VERBOSE: Found [0] Updates in pre search criteria

but as the verbose shows it works

What does this PR do

Standards checklist

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • Optional: I have tested the code myself

For new steps

  • Optional: Topgrade skips this step where needed
  • Optional: The --dry-run option works with this step
  • Optional: The --yes option works with this step if it is supported by
    the underlying command

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.

Refactor the `windows_update` function in `windows.rs` to improve the Windows Update step. Added a prompt for administrator privileges and updated the warning message. Also, added support for installing the PSWindowsUpdate Module as an alternative to using USOClient for Windows Update.

still see warning:
The installer will request to run as administrator, expect a prompt.
Start-Process : A parameter cannot be found that matches parameter name 'Command'.
At line:1 char:74
+ ... ath powershell -Verb runAs -ArgumentList  -NoProfile -Command Import- ...
+                                                          ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

VERBOSE: MSI-THIN-GF36 (6/30/2024 4:48:48 PM): Connecting to Microsoft Update server. Please wait...
VERBOSE: Found [0] Updates in pre search criteria

but as the verbose shows it works
@niStee
Copy link
Contributor Author

niStee commented Jul 21, 2024

Blocked by #871

@SteveLauC
Copy link
Member

Blocked by #871

Fixed now

@niStee niStee marked this pull request as ready for review July 27, 2024 14:05
@niStee
Copy link
Contributor Author

niStee commented Jul 27, 2024

#837
#867

@SteveLauC
Copy link
Member

SteveLauC commented Jul 29, 2024

Thanks for the patch!

cc @BoYanZh @BobG1983, could you guys give this patch a try and see if it addresses your issues?

If you don't have a Rust toolchain installed, I can build Topgrade with this patch in my Windows VM, but I am not familiar with Windows, if I directly send the exe file, is it executable on your machines?

@BoYanZh
Copy link

BoYanZh commented Jul 29, 2024

Thanks for the patch!

cc @BoYanZh @BobG1983, could you guys give this patch a try and see if it addresses your issues?

If you don't have a Rust toolchain installed, I can build Topgrade with this patch in my Windows VM, but I am not familiar with Windows, if I directly send the exe file, is it executable on your machines?

I have tried it and it works! I built it with cargo build --release --target x86_64-pc-windows-gnu; cross build --release --target x86_64-pc-windows-gnu in my WSL.

@SteveLauC
Copy link
Member

I have tried it and it works! I built it with cargo build --release --target x86_64-pc-windows-gnu; cross build --release --target x86_64-pc-windows-gnu in my WSL.

Nice, thanks for testing it!

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this PR

@SteveLauC SteveLauC merged commit 8ece034 into topgrade-rs:main Aug 1, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows Update fails with Win32 internal error Windows system update with PSWindowsUpdate does not work
3 participants