Quantcast
Channel: Dustmen.net » ESXi
Viewing all articles
Browse latest Browse all 5

Append Notes to Virtual Machine with PowerCLI

$
0
0

We use NetBackup to back up our virtual environment. The exclusion queries used by NetBackup can be cumbersome to manage when you have a large environment like we do. One feature supported in NetBackup is to query the Notes field of a VM. It also supports custom attributes, but we’re not at the version that does yet. This is done by adding the text “nosnap” to a new line in the VM notes field. This enables our backup admins to have an easy to manage query for which VM’s can’t be backed up via snapshot. Handy for VM’s with RDM’s in physical compatability mode. This script does not replace the existing text in the notes field.

 

# Input array, includes all VM names within vCenter you wish to edit.
$vms = “VMName1″,”VMName2″,”etc”,”etc”

# Loop through all VMs within the array above
ForEach ($vmname in $vms)
{
# Create variables . Also create a string $note to use with the command.
$vm = Get-VM $vmname;
$existingnotes = (Get-VM $vm).Description

# Set this to what you want it to be.

$note = “nosnap”;

Set-VM $vm -Notes “$existingnotes`n$note” -Confirm:$false;
}

 


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images