Skip to content

Add back Get-HotFix cmdlet - #10740

Merged
Ilya (iSazonov) merged 5 commits into
PowerShell:masterfrom
SteveL-MSFT:get-hotfix
Oct 11, 2019
Merged

Ilya (iSazonov) merged 5 commits into
PowerShell:masterfrom
SteveL-MSFT:get-hotfix

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Oct 8, 2019 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
Member Author

Aditya Patwardhan (@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 Ilya (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 Ilya (iSazonov) added this to the 7.0.0-preview.5 milestone Oct 9, 2019
@anmenaga

Copy link
Copy Markdown

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
Copy Markdown
Member Author

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

@iSazonov
Ilya (iSazonov) merged commit 1fa73e3 into PowerShell:master Oct 11, 2019
"Get-TimeZone",
"Set-TimeZone")
"Set-TimeZone",
"Get-HotFix")

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Christoph Bergmeister (bergmeister) commented Oct 11, 2019 •

Copy link
Copy Markdown
Contributor

Steve Lee (@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
Copy Markdown
Member Author

Christoph Bergmeister (@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
Copy Markdown
Collaborator

Updated comment there #2123 (comment)

@iSazonov

Copy link
Copy Markdown
Collaborator

Also DefaultCommands.Tests.ps1 is good source.

@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the get-hotfix branch October 11, 2019 22:40
@ghost

Copy link
Copy Markdown

🎉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
Ryan Yates (kilasuit) pushed a commit to kilasuit/PowerShell that referenced this pull request Nov 9, 2019
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
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