Hi,
I am looking for kind of help to create a script of below task
The task are below.
1. Need to check the VM is powered off.
2. If powered off, I need to rename the display name.
3. Add the notes in the VM
4. Convert it to template
5. Move it to "New Folder" to keep it somedays in the VMs & Templates folder.
Looking for experts help to reduce my manual work. Thanks in advance.
Try something like this
foreach($vm in (Get-VM | where {$_.PowerState -eq "PoweredOff"})){ Set-VM -VM $vm -Name $newname -Notes $description -Confirm:$false
$template = Set-VM -VM $vm -ToTemplate -Confirm:$false
Move-Template -Destination (Get-Folder -Name "New Folder") -Template $template -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try something like this
foreach($vm in (Get-VM | where {$_.PowerState -eq "PoweredOff"})){ Set-VM -VM $vm -Name $newname -Notes $description -Confirm:$false
$template = Set-VM -VM $vm -ToTemplate -Confirm:$false
Move-Template -Destination (Get-Folder -Name "New Folder") -Template $template -Confirm:$false
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks. It works perfectly.
if possible Could you please modify this script based on this requirement.
The script should prompt for VM name and description. As i don't have idea how to amend this changes in this script, I am just hitting you again.
Thanks in advance.