Change/Update DNS or domain with vSphere PowerCLI

There was some confusion on how to specify multiple dns server ip address or domain search names with the Set-VMHostNetwork cmdlet. Turns out is a simple comma separated list that get treated as a parameter array. Here is an example. Connect-viserver vCenterServerFQDNorIP $ESXiHosts = Get-VMHost foreach ($esx in $ESXiHosts) { Get-VMHostNetwork | Set-VmHostNetwork -DomainName eng.example.com … Read more

Add iSCSI send targets with vSphere PowerCLI

Here’s a quick how to add iSCSI send targets on all hosts in your VC Connect-viserver vCenterServerFQDNorIP $targets = “StorageTargetIP1”, “StorageTargetIP2” $ESXiHosts = Get-VMHost foreach ($esx in $ESXiHosts) { $hba = $esx | Get-VMHostHba -Type iScsi | Where {$_.Model -eq “iSCSI Software Adapter”} foreach ($target in $targets) { # Check to see if the SendTarget … Read more

Enable and configure SNMP in vSphere 6 (ESXi)

Get command line access with SSH or ESXi Console as user root. Then run the following commands to enable SNMP and configure SNMP v2 community, SysLocation and SysContact. esxcli system snmp set -r esxcli system snmp set -c esxsnmpusr esxcli system snmp set -p 161 esxcli system snmp set -L “California, USA” esxcli system snmp … Read more

Set NTP on vSphere hosts via PowerCLI

As you saw in the previous post, missing ntp configuration on one the vSphere hosts burnt me. I did not want to go through 30 some hosts manually, so decided to bulk update the ntp configuration on all my hosts. After a quick google search i found SnowVM blog post on this. Here is the … Read more