Powershell: Will PowerShell 6 have Get-HotFix?

Created on 18 Sep 2016  路  18Comments  路  Source: PowerShell/PowerShell

Is Get-HotFix a Microsoft-only thing?

Area-Cmdlets Resolution-Fixed

Most helpful comment

The reason it was missing previously is that it relied on the old WMI .NET APIs which didn't exist in .NET Core 2.x. However, they are back so we can re-enable this cmdlet with some small changes. Working on a PR.

All 18 comments

Get-Hotfix uses a CIM (WMI) class - root\cimv2\Win32_QuickFixEngineering
so will only work on systems that have that class available. At the moment that's Windows boxes only

@RichardSiddaway - Thanks for your reply. Is there any plan to include other platforms? I can understand that Apple could respond with support, but am not suggesting that they would. How would Linux distros support such a capability?

This is another one that a vendor such as Red Hat, Ubuntu, and/or Apple should pick up.

If this were to be made xplat, I would imagine it would perhaps be best reimplemented as a PSProvider of sort.

Can we add this cmdlet back for Windows for PowerShell v7 backwards compatibility?

@SteveL-MSFT Please confirm that we can bring the cmdlet back as Windows-only. Or is current intention to use it by a compatibility tool?

Let me look into this a bit

The reason it was missing previously is that it relied on the old WMI .NET APIs which didn't exist in .NET Core 2.x. However, they are back so we can re-enable this cmdlet with some small changes. Working on a PR.

So I got it working on my Win10 machine, however it doesn't return anything. This cmdlet basically wraps the WMI query: select * from Win32_QuickFixEngineering, which also doesn't return anything on my Win10 machine when used directly outside of PowerShell.

@SteveL-MSFT that's strange, I can run a Get-CimInstance and get values returned on my Win10 machine on PS 6.2.2 and 7-preview4.

PS C:\> Get-CimInstance -ClassName Win32_QuickFixEngineering

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
              Update           KB4495618     NT AUTHORITY\SYSTEM  6/12/2019 12:00:00 AM
              Security Update  KB4470788                          3/12/2019 12:00:00 AM
              Security Update  KB4503308     NT AUTHORITY\SYSTEM  6/12/2019 12:00:00 AM
              Security Update  KB4504369     NT AUTHORITY\SYSTEM  6/12/2019 12:00:00 AM
              Security Update  KB4509095     NT AUTHORITY\SYSTEM  8/11/2019 12:00:00 AM
              Security Update  KB4512577     NT AUTHORITY\SYSTEM  9/27/2019 12:00:00 AM
              Security Update  KB4516115     NT AUTHORITY\SYSTEM  9/27/2019 12:00:00 AM
              Security Update  KB4512578     NT AUTHORITY\SYSTEM  9/27/2019 12:00:00 AM

@tnieto88 the key part is:

This cmdlet basically wraps the WMI query: select * from Win32_QuickFixEngineering, which also doesn't return anything on my Win10 machine when used directly outside of PowerShell.

In other words, somehow this WMI/CIM class only exists inside PowerShell; the direct .NET APIs for this kind of thing won't work, which doesn't bode well for a binary cmdlet. wmic also can't find it either.

That's a first for me, @SteveL-MSFT, has this sort of thing been done before? 馃槙

@vexx32 would it be possible to rewrite it to be a cdxml instead of a binary cmdlet to avoid that issue?

@tnieto88 let me create a Win10 VM that isn't domain joined in case something is happening there to try it. I don't think it makes sense to rewrite it. The code is pretty simple, just need a system that has instances of that class to test against.

But the class is included in the standard WMI class documentation - https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering

I've got a script from the Windows 2000 Scripting Guide that uses Win32_QickFixengineering class via VBScript so it should be accessible outside of PowerShell

In theory it would be possible to produce a CDXML wrapper for the class. I can experiment with that if required

The Win32\_QuickFixEngineering&\#8194;WMI class represents a small system-wide update, commonly referred to as a quick-fix engineering (QFE) update, applied to the current operating system.

It's certainly possible to wrap it in CDXML. Feel free to experiment!

On my Win7 VM, the cmdlet works, so I'll add some conditional tests if Win32_QFE returns any instances then submit a PR.

To be clear, this is only re-enabling the cmdlet on Windows.

:tada:This issue was addressed in #10740, which has now been successfully released as v7.0.0-preview.5.:tada:

Handy links:

Was this page helpful?
0 / 5 - 0 ratings