【问题标题】:Editing Annotations In VSphere Using PowerShell使用 PowerShell 在 VSphere 中编辑注释
【发布时间】:2017-09-22 15:23:34
【问题描述】:

我需要能够从 powershell(ps) 编辑 VM 的注释,因为将同时编辑多个 Image。在 ps Image 中获取 VM 视图后,我找到了“AvailibleField”,但不知道如何编辑这些。任何人都可以帮忙吗?谢谢:)

【问题讨论】:

    标签: powershell virtual-machine vsphere powercli


    【解决方案1】:

    我认为您正在寻找的是 Get/Set-Annotation cmdlet:http://www.vmware.com/support/developer/PowerCLI/PowerCLI651/html/Set-Annotation.html

    例子:

    PS C:\Users\kruddy> Get-VM file02 | select CustomFields
    
    CustomFields
    ------------
    {[CompanyName, ]}
    
    
    PS C:\Users\kruddy> Get-VM file02 | Get-Annotation
    
    AnnotatedEntity Name                 Value
    --------------- ----                 -----
    file02          CompanyName
    
    
    PS C:\Users\kruddy> Set-Annotation -Entity (Get-VM file02) -CustomAttribute CompanyName -Value TempCorp -Confirm:$false
    
    AnnotatedEntity Name                 Value
    --------------- ----                 -----
    file02          CompanyName          TempCorp
    
    
    PS C:\Users\kruddy> Get-VM file02 | Get-Annotation
    
    AnnotatedEntity Name                 Value
    --------------- ----                 -----
    file02          CompanyName          TempCorp
    
    
    PS C:\Users\kruddy> Get-VM file02 | select CustomFields
    
    CustomFields
    ------------
    {[CompanyName, TempCorp]}
    
    
    PS C:\Users\kruddy>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-11
      • 2023-03-17
      • 2014-09-26
      • 2019-07-06
      • 2011-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多