Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 229602

Re: Apply a host profile to multiple hosts from csv

$
0
0

The "$Host" variable is system reserved so you cannot overwrite it.

 

Your code updated:

$HostList = Import-Csv Hostprofiles.csv

Connect-VIServer -Server VIRTUALCENTER.DOMAIN.local -User "qa\a-dubutcher" -Password MYPASSWORD

# Apply host profile to all the VMs in $HostList
foreach($VMHost in $HostList) {
    Apply-VMHostProfile -Entity $($VMHost.NAME) -Profile YKFProfile -Confirm:$false
}


Viewing all articles
Browse latest Browse all 229602

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>