Hi @AndyForeman
I've made a few changes to my multi-server version. The background to this was that when I upgraded our servers from Windows Server 2012 R2 to Windows Server 2019 the WMI-based applets were returning "not authorised" errors when trying to connect to the remote servers. Out of interest, and partly because WMI is a deprecated technology, I thought I'd try changing them to using CIM instead of WMI. There's an interesting article about this here:
https://devblogs.microsoft.com/scripting/should-i-use-cim-or-wmi-with-windows-powershell/
Anyway, CIM seems to work: Get-WmiObject is replaced by Get-CimInstance, but all the parameters can stay the same. Unfortunately, you can't use the stopservice or startservice methods with CimInstance objects. Instead, you have to use the Invoke-CimMethod applet. However, this will take the CimInstance object as an InputObject. So, the following changes are made:
$status = $service.startservice()
becomes
$status = Invoke-CimMethod -InputObject $service -MethodName StartService
and
$status = $service.stopservice()
becomes
$status = Invoke-CimMethod -InputObject $service -MethodName StopService
... View more