Extract Summary property from VMM with PowerShell

I have a Windows Server 2008R2 running SCVMM 2012. I successfully removed a virtual machine, according to the Jobs output from VMM, as seen in this screenshot.

enter image description here

As you can see, the VM has a red dot indicating a failure. VMM doesn’t really mention it anywhere. I can only see it as a failed disk under the Failover Cluster Manager on any off the cluster nodes.

How can I retrieve this information using PowerShell?
If I do:

Get-Job -All -Full | Where-Object { $_.Name -contains "Remove virtual machine" }

I get a lot of information about this particular job, but I cannot find the Property, Previous Value, or New Value which are listed under the Summary tab.
How can I extract these details about this VM?

Answer

-contains operator should be used for collections(arrays or others) so it is likely you are looking at a wrong object. From http://technet.microsoft.com/en-gb/library/hh847759.aspx:

-Contains

Description: Containment operator. Tells whether a collection of reference
values includes a single test value. Always returns a Boolean value. Returns TRUE
only when the test value exactly matches at least one of the reference values.

Try this:

Get-Job -All -Full | Where-Object { $_.Name -match "Remove virtual machine" }

Attribution
Source : Link , Question Author : slybloty , Answer Author : Raf

Leave a Comment