bcwilhite / PendingReboot

Module to detect Windows OS pending reboots
MIT License
125 stars 26 forks source link

Switch to CIM cmdlets #8

Open exchange12rocks opened 4 years ago

exchange12rocks commented 4 years ago

Hi Brian! As far as I know, WMI cmdlets are considered deprecated. Do you think it's worth to switch to CIM cmdlets? Or implement both and let users to choose which one to use via a switch parameter?

bcwilhite commented 4 years ago

Actually this was on my to-do list at one point. I think it's a good idea to switch over given that v3 should be the least version widely used. I suppose a switch parameter could be used in order to leverage WMI, although I'd just prefer to go one way or the other and not have to support both.

alayac commented 4 years ago

This is a great module and we use it extensively in our organization (along with it's predecessor from Technet Gallery). I just tried this module in PowerShell 7 and it doesn't like the WMI cmdlets. Migrating to the CIM cmdlets should make this work in the latest version of PowerShell natively. No need to use a switch operator to support both. The CIM cmdlets are comparable and better optimized anyway. Thanks!

dennisl68-castra commented 3 years ago

Since PoSH 7.1 is 99% compatbile with PoSH 5.1, it's a shame that the WMI-dependency still exists in this module... Why not just drop the WMI-support and move to a v2 release?

realslacker commented 1 year ago

@bcwilhite if you merge this and someone needs WMI support they can just install the last release before switching to CIM. The current version has been working for people for years, so they should be able to just keep using it. Maybe just putting some explicit install instructions so people understand that to use WMI they use 0.9.0.6, anything after that uses CIM.

DennisL68 commented 1 year ago

It seems that CIM itself is supported in PowerShell since v3...

I.e. natively in Windows 8 and later.

So who is actually bound to using WMI if not using an unsupported Windows version?

https://devblogs.microsoft.com/scripting/what-is-cim-and-why-should-i-use-it-in-powershell/

https://devblogs.microsoft.com/powershell/introduction-to-cim-cmdlets/

realslacker commented 1 year ago

@DennisL68 CIM uses WinRM (WSMAN) where WMI uses native WMI calls. I've come across a few scenarios where WMI is enabled, but WinRM is not, and vice-versa.

DennisL68 commented 1 year ago

@DennisL68 CIM uses WinRM (WSMAN) where WMI uses native WMI calls. I've come across a few scenarios where WMI is enabled, but WinRM is not, and vice-versa.

Yes, WMI uses RPC where as CIM uses a more controlled protocol as a carrier :)

SamErde commented 11 months ago

It shouldn't be hard to include an option to use WMI as a fallback method.