-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Add back Get-HotFix
cmdlet
#10740
Conversation
src/Microsoft.PowerShell.Commands.Management/Microsoft.PowerShell.Commands.Management.csproj
Show resolved
Hide resolved
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"') |
@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. |
src/Microsoft.PowerShell.Commands.Management/commands/management/Hotfix.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Get-HotFix.Tests.ps1
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Management/Get-HotFix.Tests.ps1
Outdated
Show resolved
Hide resolved
Tiny Codacy issue in new code should be fixed. Btw, is there info on when (approximately:year/PSVersion) Get-HotFix was removed? |
@anmenaga |
@@ -66,5 +66,6 @@ CmdletsToExport=@("Add-Content", | |||
"Rename-Computer", | |||
"Get-ComputerInfo", | |||
"Get-TimeZone", | |||
"Set-TimeZone") | |||
"Set-TimeZone", | |||
"Get-HotFix") |
There was a problem hiding this comment.
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?) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@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? |
@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. |
Updated comment there #2123 (comment) |
Also DefaultCommands.Tests.ps1 is good source. |
🎉 Handy links: |
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
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.Get-HotFix
documentation back for PS7 MicrosoftDocs/PowerShell-Docs#4908