VMware vCenter enables Administrators to add metadata to VMs and vApps in the form of Notes, Tags and Attributes. Using the Windows Task Scheduler with the PowerShell scripts provided in this article, administrators can synchronize vCenter metadata to a custom attribute in vCommander®, up to 255 characters.



Important: VMs with duplicate names under a single vCenter server will be ignored during the synchronization process, even if they have different parent elements (for example being contained in different datacenters). The notes and tags for these VMs will have to be added to vCommander manually.


Requirements


  • vCommander scripts (Download here)
  • vCommander custom attributes created to take values
  • PowerShell v3 installed on the vCommander application server
  • Embotics® vCommander™ 5.2 or later
  • VMware PowerCLI
  • Embotics vCommander REST API powershell libraries (Download here)


Creating Custom Attributes


The first thing to do is create a custom attribute in vCommander to store the information. Follow the steps below to do so.

  1. Under the Configuration menu, choose Custom Attributes. Click Add.
  2. Name the attribute vCenter Notes and provide a meaning Description.
  3. Select Applies To: All and Type: Text.
  4. Uncheck Edit in Service Portal (changes made in vCommander are not synchronized back into vCenter). Click Next.

  5. Leave Free Form selected and click Finish.

Perform the same steps to create custom attributes to accept the values for vCenter Tags and Annotations.

Prepare the Script Files


Download and extract the script to your vCommander application server. Embotics recommends storing all scripts called by vCommander in a single location, using sub-folders to identify the functions of particular scripts. This script is not executed by vCommander, but storing them in the same area is still recommended. With the scripts extracted, the file system will look like this:


The scripts require minor editing before they will work with your systems. Refer to the comments in the individual script or the table below for guidance on editing the contents.


SettingDescription
$vCommanderServerThe hostname or IP address of the vCommander server.
$CredFileThe credentials file which handles access to your vCommander. For more details, please refer to the Appendix: PowerShell Script Credential Encryption in the vCommander API Getting Started Guide, available here.
$VIServerThe vCenter Server name as it appears in vCommander. This value must be resolvable via DNS and reachable from the vCommander application server.
$vCredFileThe credentials file which handles access to your vCenter. The user must have permission to read the notes for all the VMs you wish to synch to vCommander.
$Attrib2updateThe name of the attribute you created in vCommander to hold the values.
$TagCategoryThe category name of the tag you want to populate in vCommander.


Configure Windows Task Scheduler


Windows Task Scheduler is used to execute this script on the schedule you define. The steps to configure below are an example using Windows 2008 R2. Other versions of the server OS may introduce slight variations. If you encounter these, refer to Microsoft documentation or contact Embotics Technical Support for assistance.

  1. Logged in as an Administrator, Open Task Scheduler from the Administrative Tools in the Start Menu.
  2. In the Actions pane, click Create Basic Task.
  3. Name the task Synchronize vCenter Notes to vCommander and add a meaningful Description. Click Next.
  4. Choose to trigger the task Daily and click Next. Choose a time to run the task, and set it to recur every day. Click Next.

  5. Choose Start a program and click Next. Click Browse… to locate the PowerShell executable.
  6. Add the argument: 

    & 'C:\Scripts\vCenterNotes2vCommanderv2.ps1'

     
    using the correct path to your copy of the script. Click Next.

  7. Click Finish.

Perform the same steps to create custom attributes to accept the values for vCenter Tags and Annotations.

Update VM Details


Finally, interested users must configure the custom attributes holding the values to appear for them in vCommander.

  1. Open the Summary tab for any VM in vCommander.
  2. Click  in the Details section.
  3. Locate and select the custom attribute you created in the Hidden Properties list. Click Add > to move it to the Shown Properties list.

  4. Use the Move Up and Move Down buttons to order where the information will appear in the list, and click OK.

Perform the same steps to create custom attributes to accept the  values for vCenter Tags and Annotations. If the entirety of the values  are not viewable, they will popup with a mouse-over.