PowerShell / MMI

Other
24 stars 17 forks source link

WIndowsUpdate Class Implementation #31

Closed NonSecwitter closed 5 years ago

NonSecwitter commented 6 years ago

On Windows 10 and Server 2016 DataCenter, there seems to be a problem with CIM class MSFT_WUOperationsSession in namespace root/Microsoft/Windows/WindowsUpdate

Expected Behavior

It seems that the class was properly implemented in server Nano: https://blogs.technet.microsoft.com/nanoserver/2016/01/16/updating-nano-server-using-windows-update-or-windows-server-update-service/

Following the outlined instructions, I would expect to be able to search for and apply updates on any Windows 10/Server 2016 based operating system.

Current Behavior

This command: $sess = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession

Returns this error:

New-CimInstance : Invalid class At line:1 char:9 $sess = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpda ...


CategoryInfo  : MetadataError: (MSFT_WUOperationsSession:CimInstance) [New-CimInstance], CimException
FullyQualifiedErrorId : HRESULT >0x80041010,Microsoft.Management.Infrastructure.CimCmdlets.NewCimInstanceCommand

However, the class and all of its methods are listed using: Get-CimClass -Namespace root/Microsoft/Windows/WindowsUpdate

and

Get-CimClass -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession | select -ExpandProperty CimClassMethods

Possible Solution

Complete or update implementation of MSFT_WUOperationsSession for Windows 10 and Server 2016.

Steps to Reproduce

  1. Open Powershell on Windows 10 or Server 2016 Datacenter
  2. Execute: $sess = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
  3. Execute: Get-CimClass -Namespace root/Microsoft/Windows/WindowsUpdate
  4. Execute: Get-CimClass -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession | select -ExpandProperty CimClassMethods

Context (Environment)

Lack of implementation prevents programmatic control of windows updates through CIM/WMI, particularly remote control over WinRM/WSMan.

There is a COM object for the Windows Update Agent, but it doesn't support remote execution. Implementing over WinRM/WSMan would improve control of resources from a centralized or remote location.

adityapatwardhan commented 5 years ago

This seems like an issue which should be tracked as user voice here: https://windowsserver.uservoice.com/forums/301869-powershell?category_id=148053

Andy43Irl commented 2 years ago

This issue is still unresolved.