Skip to content

Add back Get-HotFix cmdlet #10740

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

Merged
merged 5 commits into from
Oct 11, 2019
Merged

Add back Get-HotFix cmdlet #10740

merged 5 commits into from
Oct 11, 2019

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Oct 8, 2019

PR Summary

Re-enable Get-HotFix cmdlet on Windows. Since the WmiHelper class relies on WMI cmdlets, rewrote the code a bit to not use it. Added tests that depend on Win32_QuickFixEngineering WMI class returning results. Removed a bunch of referenced namespaces in the original source file that aren't needed as well as an old comment.

PR Context

Fix #2296

PR Checklist

@adityapatwardhan
Copy link
Member

Should this just re-written over MMI / CIM APIs, seems simple enough? It would be like:

[cimsession]::Create('localhost').QueryInstances("root/cimv2", 'WQL', 'select * from Win32_QuickFixEngineering')

or

[cimsession]::Create('localhost').QueryInstances("root/cimv2", 'WQL', 'select * from Win32_QuickFixEngineering where hotfixid="KB4514359"')

@SteveL-MSFT
Copy link
Member Author

@adityapatwardhan doesn't seem to provide much benefit to rewrite. We could have rewrote it in PS6 timeframe as it would have made sense then.

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Oct 9, 2019
@iSazonov iSazonov added this to the 7.0.0-preview.5 milestone Oct 9, 2019
@anmenaga
Copy link

Tiny Codacy issue in new code should be fixed.

Btw, is there info on when (approximately:year/PSVersion) Get-HotFix was removed?

@SteveL-MSFT
Copy link
Member Author

@anmenaga Get-HofFix was removed from PSCore6.0 because the System.Management namespace wasn't available.

@iSazonov iSazonov merged commit 1fa73e3 into PowerShell:master Oct 11, 2019
@@ -66,5 +66,6 @@ CmdletsToExport=@("Add-Content",
"Rename-Computer",
"Get-ComputerInfo",
"Get-TimeZone",
"Set-TimeZone")
"Set-TimeZone",
"Get-HotFix")
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor nit: For a cleaner history, it would've been be nice if parentheses/commas were placed in such a way that the last line does not require any change for the next addition (i.e. have the closing parenthesis in this case on the next line).

// catch (ArgumentException) // thrown (indirectly) by SecurityIdentifier.constr (on XP only?)
// { catch not needed - this is already caught as SystemException
// }
// catch (PlatformNotSupportedException) // thrown (indirectly) by SecurityIdentifier.Translate (on Win95 only?)
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, was powershell v1 supported on win95 (I though PS came out only around the XP times)? Or is this still from Monad days?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if v1 actually supported 95, although I suspect not. This error seems like a developer trying to cover their bases for exceptions.

@bergmeister
Copy link
Contributor

bergmeister commented Oct 11, 2019

@SteveL-MSFT Out of interest: Is there a list of issues or tags for low hanging fruits of cmdlets that can now be brought back relatively easily with .Net Core 3?

@SteveL-MSFT
Copy link
Member Author

@bergmeister probably this one at least for Utility module: #2123, there's a few open issues on specific cmdlets. I already have a PR open for Clipboard cmdlets.

@iSazonov
Copy link
Collaborator

Updated comment there #2123 (comment)

@iSazonov
Copy link
Collaborator

Also DefaultCommands.Tests.ps1 is good source.

@SteveL-MSFT SteveL-MSFT deleted the get-hotfix branch October 11, 2019 22:40
@ghost
Copy link

ghost commented Oct 23, 2019

🎉v7.0.0-preview.5 has been released which incorporates this pull request.:tada:

Handy links:

@ghost ghost mentioned this pull request Oct 23, 2019
kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Will PowerShell 6 have Get-HotFix?
7 participants