Get-WmiObject inconsisten or NULL values returned


I have the following Powershell line to get information about the progress of HyperV merge and replication sync status on a Windows Server 2016 installation :
Get-WmiObject -Namespace “root\virtualization\v2” -Query “select * from Msvm_ConcreteJob” | select name,PercentComplete

My issue is it often returns a blank line when it should return a value as I know its doing something. So for instance if HyperV is doing a replication resync I run the command and it shows me the percentage complete:
name PercentComplete

Resynchronizing 46

If I run it again it often returns a blank line, if I leave it a minute or so then run it again I get a result but often with more information:

name PercentComplete

Modifying Resource 100
Applying Replica Changes 50
Apply Registered Delta 0
Merge in Progress 100
Applying Replica Changes 0
Receiving changes 100
Resynchronizing 46
Receiving changes 100

Why is it inconsistent when returning values partuclarly the Resyncronization value that should return a value until its compelte?



WMI/CIM consists of a bazillion little underlying “providers.” Those providers are responsible for sticking data into the repository and responding to queries; in this case, the provider appears to be Not Well Written. It’s likely related to Hyper-V’s management architecture, but there’s not much you can do in terms of gaining insight or fixing it.

But it’s not PowerShell’s fault, if that helps :wink: