Automation

 View Only
  • 1.  Having trouble populating Owner CustomAttribute

    Posted Aug 02, 2013 08:07 PM

    Get-VM | Select @{N="VM";E={$_.name}},@{N="Tools Version";E={$_.version}},

    @{N="Owner";E={(Get-VM $_.name | Get-Annotation -CustomAttribute "Owner")}} |

    Export-Csv tools.csv  -NoTypeInformation



  • 2.  RE: Having trouble populating Owner CustomAttribute
    Best Answer

    Posted Aug 02, 2013 09:51 PM

    Perhaps try like this

    Get-VM | Select @{N="VM";E={$_.name}},@{N="Tools Version";E={$_.version}},

    @{N="Owner";E={(Get-VM $_.name | Get-Annotation -CustomAttribute (Get-CustomAttribute -Name "Owner"))}} |

    Export-Csv tools.csv  -NoTypeInformation



  • 3.  RE: Having trouble populating Owner CustomAttribute

    Posted Aug 13, 2013 07:31 PM

    This works...thanks



  • 4.  RE: Having trouble populating Owner CustomAttribute

    Posted Aug 02, 2013 09:52 PM

    Hello, -

    You were close.  Just needed to adjust the calculated property for "Owner" a bit, like:

        Get-VM | Select @{N="VM";E={$_.name}},@{N="ToolsVersion";E={$_.ExtensionData.Config.Tools.ToolsVersion}},
            @{N
    ="Owner";E={(Get-Annotation -Entity $_ -CustomAttribute "Owner").Value}} |
           
    Export-Csv c:\temp\tools.csv -NoTypeInformation -UseCulture

    Also, the value that you were using for "Tools Version" was actually the VM's virtual hardware version.  I adjusted that calculated property to get the VMware Tools version for the given VM.

    That do it for you?

    Edit:  doh, Luc is quicker than me on the response...



  • 5.  RE: Having trouble populating Owner CustomAttribute

    Posted Aug 02, 2013 09:56 PM

    But yours looks nicer :heart:



  • 6.  RE: Having trouble populating Owner CustomAttribute

    Posted Aug 02, 2013 10:45 PM

    lol



  • 7.  RE: Having trouble populating Owner CustomAttribute

    Posted Aug 13, 2013 07:31 PM

    Thanks Matt