Create unique host profiles for each host in a cluster

The below command will create a host profile for each host found in $global:CLUChoice, The profile will be named “VMhostName-Profile” and will include the date the profile was taken in the description

$global:DCChoice – Datacenter
$global:CLUChoice – Cluster

Get-Datacenter $global:DCChoice | Get-Cluster $global:CLUChoice | Get-VMHost |
ForEach-Object -Process {

    New-VMHostProfile -Name "$($_.Name)-Profile" -Description "$($_.Name)) Profile. This profile was created on $(get-date -f yyyy-MM-dd)" -ReferenceHost $_ -Confirm:$false

}

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.