使用 PowerShell 在 VSphere 中编辑注释
Editing Annotations In VSphere Using PowerShell
我需要能够从 powershell(ps) 编辑 VM 的注释,因为我将同时编辑多个 Image. I found "AvailibleField" after getting VM view in ps Image 但不确定如何编辑这些。谁能帮忙?谢谢:)
我认为您正在寻找的是 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>
我需要能够从 powershell(ps) 编辑 VM 的注释,因为我将同时编辑多个 Image. I found "AvailibleField" after getting VM view in ps Image 但不确定如何编辑这些。谁能帮忙?谢谢:)
我认为您正在寻找的是 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>