Task Name | Creating a TAG vCenter for a given VM |
Description |
|
Prerequisites | - Tested on 5.3.1.1
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs | |
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.
The workflow:
User input to the workflow:
The workflow execution:
The run time variables:
The log file:
Code section to set up file on target:
echo 'param($vcent, $vmname, $vmtag)' > C:\\PowerCLICreateVMTAG.ps1
echo 'Add-PSSnapin VMware.VimAutomation.Core' >> C:\\PowerCLICreateVMTAG.ps1
echo 'Set-powercliconfiguration -InvalidCertificateAction ignore -Confirm: $false' >> C:\\PowerCLICreateVMTAG.ps1
echo 'Connect-viserver -server $vcent -protocol https -User root -Password vmware' >> C:\\PowerCLICreateVMTAG.ps1
echo 'Get-VM -Name $vmname | New-TagAssignment -TAG $vmtag -Confirm: $false' >> C:\\PowerCLICreateVMTAG.ps1
echo 'Disconnect-VIServer -Server $vcent -Force -Confirm: $false' >> C:\\PowerCLICreateVMTAG.ps1
echo 'exit 0' >> C:\\PowerCLICreateVMTAG.ps1
Code section to execute the newly created file:
C:\\PowerCLICreateVMTAG.ps1 ${vCenter} ${VM_Name} ${VM_TAG}| out-null
***Note***
The command New-TagAssignment assumes that the tag does exist in vCenter. This does not create a new tag! It will however create a tag entry on a vm.
The tags created during workflow executions:
Some of the debugging by products on the PSA machine: