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.
- 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.
- Under the Configuration menu, choose Custom Attributes. Click Add.
- Name the attribute vCenter Notes and provide a meaning Description.
- Select Applies To: All and Type: Text.
- Uncheck Edit in Service Portal (changes made in vCommander are not synchronized back into vCenter). Click Next.
- Leave Free Form selected and click Finish.
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.
|$vCommanderServer||The hostname or IP address of the vCommander server.|
|$CredFile||The 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.|
|$VIServer||The vCenter Server name as it appears in vCommander. This value must be resolvable via DNS and reachable from the vCommander application server.|
|$vCredFile||The 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.|
|$Attrib2update||The name of the attribute you created in vCommander to hold the values.|
|$TagCategory||The 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.
- Logged in as an Administrator, Open Task Scheduler from the Administrative Tools in the Start Menu.
- In the Actions pane, click Create Basic Task.
- Name the task Synchronize vCenter Notes to vCommander and add a meaningful Description. Click Next.
- 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.
- Choose Start a program and click Next. Click Browse… to locate the PowerShell executable.
- Add the argument:
using the correct path to your copy of the script. Click Next.
- Click Finish.
Update VM Details
Finally, interested users must configure the custom attributes holding the values to appear for them in vCommander.
- Open the Summary tab for any VM in vCommander.
- Click in the Details section.
- Locate and select the custom attribute you created in the Hidden Properties list. Click Add > to move it to the Shown Properties list.
- Use the Move Up and Move Down buttons to order where the information will appear in the list, and click OK.