Last active
November 15, 2018 14:30
-
-
Save ej-github/aede4159782d2cb9574cf787a468b01c to your computer and use it in GitHub Desktop.
Update Notes for vCenter VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VMware vRealize Orchestrator action sample | |
// | |
// Update the notes for a vCenter VM | |
// | |
// For vRO 7.0+ | |
// | |
// Action Inputs: | |
// vm - VC:VirtualMachine - vCenter VM Object | |
// notes - string - New vCenter VM Notes | |
// | |
// Return type: string - Notes for VM | |
if (!vm) { throw "VM not provided" } | |
if (!notes) { notes = ""; } | |
var oldNotes = vm.summary.config.annotation; | |
if (!oldNotes) { oldNotes = ""; } | |
System.debug("Old VM Notes: "+oldNotes); | |
System.debug("New VM Notes: "+notes); | |
var configSpec = new VcVirtualMachineConfigSpec(); | |
configSpec.annotation = notes; | |
// Start VM reconfigure task | |
var task = vm.reconfigVM_Task(configSpec); | |
// Wait for task to end | |
var progress = false; | |
var pollRate = 5; | |
System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(task,progress,pollRate) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment