Home > ESX, PowerCLI, VMUG > Thinking, Building and Scripting Globally – a London VMUG presentation.

Thinking, Building and Scripting Globally – a London VMUG presentation.

I have the privilege today of presenting at the London VMware User Group.

My presentation is split into two parts, first of all looking at why setting standards, creating processes and adding automation is now more important than ever as we work towards building an infrastructure for cloud computing.

I go through how “cloud thinking” is not just about the cloud being used to solve an IT problem but rather the cloud being a busines transformation to increase your business flexibility.

Your ESX(i) host build is the foundation of that cloud.

Then I head into the technical details of how to create a single PowerCLI script to build ESX or ESXi anywhere in your organisation. Using PowerCLI removes the dependency on any Service Console scripting so you can move towards an ESXi only infrastructure as that is the only hypervisor option for vSphere 5.

Having a single global script allows you to set standards and gives you way to reduce complexity & errors.

The script needs to work within the global standards you have defined by using global host names, IP address schemes, storage protocols, networking etc. while being able to take into account site specifics such as cluster requirements, different IP addresses and local networking.

The script uses hostnames and IP addresses to calculate where in the world the host is being built and what it will be hosting and then can automagically add the correct networking and datastores.

I’m actually only the warm-up act though for Jonathan Medd (vExpert AND MVP!) who is presenting: How to Save your Time With PowerCLI.

Here’s a link to the presentation:

The script is designed to configure ESX(i) on a blade host which uses 4 x Nics (2 x for Service Console/Management, 2 for vMotion)
See my previous post which talks about network design for blades.

Here is the script:

@"
===============================================================================
Title:         Global-Blade-ESX(i)HostBuild.ps1
Description:   Scripted Install for ESX 4.0/4.1 on a Blade Server
Usage:         .\Global-Blade-ESX(i)HostBuild.ps1
Author:        Julian Wood
               www.WoodITWork.com
Date:          14/07/2011
===============================================================================
"@

Write-Host "Disconnecting from any VC / ESX(i) Hosts if connected"  -ForegroundColor Cyan
If ($Defaultviservers -ne $null) {$Defaultviservers | Disconnect-VIServer -Confirm:$False}
Write-Host ""
Write-Host "Enter ESX(i) Host FQDN / IP " -ForegroundColor Magenta

$VMHost = ""
$VMHost = read-host
If ($VMHost -eq "") {
   Write-Host "No ESX(i) Host Supplied, Exiting" -ForegroundColor Red
   Exit
}

Write-Host "Enter ESX(i) host credentials to authenticate" -ForegroundColor Magenta
$ESXCred = $host.ui.PromptForCredential("ESX(i) credentials", "Please enter the ESX(i) host user name and password.", "", "")

$ESXConnect=Connect-VIServer -Server $VMHost -Credential $ESXCred
If ($ESXConnect.IsConnected -ne $true){
   Write-Host "Cannot connect to ESX(i) Host, Exiting" -ForegroundColor Red
   Exit
}
$ESXHost=Get-VMHost

Write-Host "Getting Host Networking Information"  -ForegroundColor Cyan
Write-Host ""
$HostNetworkInfo = $ESXHost | Get-VMHostNetworkAdapter | where {($_.PortGroupName -eq "Service Console") -or ($_.PortGroupName -eq "Management Network")}
$ConsoleNic = ($HostNetworkInfo | Select IP).IP

$ESXHostView=$ESXHost | Get-View

#Get actual ESX hostname
$VMHost = $ESXHostView.Name

Write-Host "Connected to " $ESXHostView.Config.Product.Name " host:- " $ESXHost.Manufacturer " " $ESXHost.Model ": " $VMHost -Separator "" -ForegroundColor Green
Write-Host ""

# Check whether there are existing NFS datastores which may indicate the host is currently in use.
$HostDS = Get-Datastore | where {$_.Type -eq "NFS"}
If ((($HostDS | Measure-Object).Count) -gt 0) {
Write-Host "Existing NFS Datastores on Host, cannot continue, Exiting" -ForegroundColor Red
$HostDS | Select Name, Type
Exit
}

If ($ESXHostView.Config.Product.Name -match "ESXi") {
   $ESXProduct = "ESXi"}
Else {
   $ESXProduct = "ESX"}

# Determine Host Site information based on Service Console IP Address"
switch -wildcard ($ConsoleNic) {
    "10.1.*" {$Site = "NYC"}
    "10.2.*" {$Site = "LON"}
    "10.3.*" {$Site = "TOK"}
    default {Write-Host "Can not determine ESX Host Site, Exiting" -ForegroundColor Red
         Exit
   }
}

# Work out Host Number by pulling out numbers from $VMHost variable and storing as integer
[int]$HostNum = (([regex]'\d+').matches($VMHost.Split(".")[0]) | select Value).Value

# Determine Host Use Type"
$HostType = "SRV"
If ($VMHost -match "VDI") {$HostType = "VDI"}
If ($VMHost -match "UX") {$HostType = "UNIX"}
If ($Site -eq "LON") {
   while ($HostType -eq "SRV") {
      Write-Host "Enter ESX Host Type: (" -NoNewline -ForegroundColor Green
      Write-Host "P" -NoNewline -ForegroundColor Cyan
      Write-Host ")roduction or (" -NoNewline  -ForegroundColor Green
      Write-Host "D" -NoNewline -ForegroundColor Cyan
      Write-Host ")evelopment or (" -NoNewline -ForegroundColor Green
      Write-Host "B" -NoNewline -ForegroundColor Cyan
      Write-Host ")igApp " -NoNewline -ForegroundColor Green
      $SRVAnswer = read-host
      switch ($SRVAnswer.ToUpper()) {
         "P" {$HostType = "SRVPROD"}
         "D" {$HostType = "SRVDEV"}
         "B" {$HostType = "SRVBIGAPP"}
      }
   }
}

# Set Global Settings"
$SearchDomain = "wooditwork.com","mycompany.net"
$NTPServers = "usnycntp01.wooditwork.com","gblonntp01.wooditwork.com"
$ConsoleMemory = 800
$vSwitch0PortNumber = 128

# Determine Site Specific File locations"
switch ($Site) {
    "NYC" { $ISOLocation = "nyc_vmiso"
         $PuttyFolder = "\\usnycfile01\apps\VMWare\Utilities-Tools\Putty\"
   }
   "LON" {  $ISOLocation = "vmiso"
         $PuttyFolder = "\\gblonfiler01\it\Utilities-Tools\Putty\"
   }
    "TOK" { $ISOLocation = "vmiso"
         $PuttyFolder = "\\jptokfs02\install\VMware\Utilities-Tools\Putty\"
   }
}

# Generate Site Specific IP Settings"
switch ($Site) {
    "LON" { $DNSServers = "10.2.111.78","10.2.1.47"
         $VMKernelVLAN = 530
         $VMKernelMask = "255.255.254.0"
         $VMKernelGateway = "10.2.17.254"
         $VmotionMask = "255.255.255.0"
         switch -wildcard($HostType) {
            "SRV*" {$VMKernelIP = "10.2.17.$HostNum"
                  $VmotionIP = "192.168.0.$HostNum"}
            "UNIX" {$VMKernelIP = "10.2.17." + ($HostNum+220) # Add 220 to HostNum value to work out Unix VMkernel IP
                  $VmotionIP = "192.168.0." + ($HostNum+220)}  # Add 220 to HostNum value to work out Unix vMotion IP
            "VDI" {$VMKernelIP = "10.2.17." + ($HostNum+100)  # Add 100 to HostNum value to work out VDI VMkernel IP
                  $VmotionIP = "192.168.0." + ($HostNum+100)}  # Add 100 to HostNum value to work out VDI vMotion IP
         }
   }
    "NYC" { $DNSServers = "10.1.1.101","10.1.12.78"
         $VMKernelVLAN = 134
         $VMKernelMask = "255.255.254.0"
         $VMKernelGateway = "10.1.15.254"
         $VmotionMask = "255.255.255.0"
         switch -wildcard($HostType) {
            "SRV*" {$VMKernelIP = "10.1.15.$HostNum"
               $VmotionIP = "192.168.0.$HostNum"}
            "VDI" {$VMKernelIP = "10.1.15." + ($HostNum+100)  # Add 100 to HostNum value to work out VDI VMkernel IP
               $VmotionIP = "192.168.0." + ($HostNum+100)}  # Add 100 to HostNum value to work out VDI vMotion IP
         }
   }
    "TOK" { $DNSServers = "10.3.13.72","10.3.15.12"
         $VMKernelVLAN = 603
         $VMKernelMask = "255.255.255.0"
         $VMKernelGateway = "10.3.91.1"
         $VmotionMask = "255.255.255.0"
         switch -wildcard($HostType) {
            "SRV*" {$VMKernelIP = "10.3.91." + ($HostNum+50)   # Add 10 to HostNum value to work out Server VMkernel IP
               $VmotionIP = "192.168.0." + ($HostNum+10)}   # Add 10 to HostNum value to work out Server vMotion IP
            "VDI" {$VMKernelIP = "10.3.91." + ($HostNum+170)  # Add 150 to HostNum value to work out VDI VMkernel IP
                  $VmotionIP = "192.168.0." + ($HostNum+100)}  # Add 150 to HostNum value to work out VDI vMotion IP
         }
   }
}

# Generate Site and Host Type Specific Port Groups"
switch ($Site) {
    "LON" {
      switch ($HostType) {
         "SRVPROD" {$PortGroups =   ("servers_prod1",41),
                                    ("servers_lb1",39)}
         "SRVBIGAPP" {$PortGroups = ("servers_prod1",41),
                                    ("servers_lb1",39)}
         "SRVDEV" {$PortGroups =    ("servers_dev1",33)}
         "VDI" {$PortGroups =       ("vdi1",29),
                                    ("vdi2",34),
                                    ("vdi3",38)}
         "UNIX" {$PortGroups =      ("unix_dhcp",27)}
      }
   }
   "NYC" {
      switch ($HostType) {
         "SRV" {$PortGroups =       ("servers_prod1",216)}
         "VDI" {$PortGroups =       ("vdi1",218)}
      }
   }
   "TOK" {
      switch ($HostType) {
         "SRV" {$PortGroups =       ("servers1",500),
                                    ("servers_lb",532)}
         "VDI" {$PortGroups =       ("vdi1",521),
                                    ("vdi2",522)}
      }
   }
}

# Generate Site and Host Type Specific Datastores"
switch ($Site) {
    "LON" {
      switch ($HostType) {
         "SRVPROD" {$Datastores =   ("vmiso","/vol/vmiso","gblonnfs01.wooditwork.com"),
                    ("srvprod3_gblonnfs01","/vol/srvprod3","gblonnfs01.wooditwork.com"),
                    ("vcenter_gblonnfs01","/vol/vcenter","gblonnfs01.wooditwork.com")}
         "SRVBIGAPP" {$Datastores = ("vmiso","/vol/vmiso","gblonnfs01.wooditwork.com"),
                    ("srvprod3_gblonnfs02","/vol/srvprod3","gblonnfs02.wooditwork.com"),
                    ("bigapp_gblonnfs02","/vol/bigapp","gblonnfs02.wooditwork.com"),
                    ("vcenter_gblonnfs01","/vol/vcenter","gblonnfs01.wooditwork.com")}
         "SRVDEV" {$Datastores =    ("vmiso","/vol/vmiso","gblonnfs01.wooditwork.com"),
                    ("srvdev3_gblonnfs02","/vol/srvdev3","gblonnfs02.wooditwork.com")}
         "VDI" {$Datastores =       ("vmiso","/vol/vmiso","gblonnfs01.wooditwork.com"),
                    ("vdi1_gblonnfs03","/vol/vdi1","gblonnfs03.wooditwork.com"),
                    ("vdi2_gblonnfs04","/vol/vdi2","gblonnfs04.wooditwork.com")}
         "UNIX" {$Datastores =      ("vmiso","/vol/vmiso","gblonnfs01.wooditwork.com"),
                    ("unix_servers1_gblonnfs01","/vol/uxrv1","gblonnfs01.wooditwork.com"),
                    ("unix_ws2_gblonnfs03","/vol/uxws2","gblonnfs03.wooditwork.com")}
      }
   }
   "TOK" {
      switch ($HostType) {
         "SRV" {$Datastores =       ("vmiso","/vol/vmiso1","jptokfiler01.wooditwork.com"),
                    ("srvtok1_jptokfiler01","/vol/srvtok1","jptokfiler01.wooditwork.com"),
                    ("vcenter_jptokfiler01","/vol/vcenter","jptokfiler01.wooditwork.com")}
         "VDI" {$Datastores =       ("vmiso","/vol/vmiso1","jptokfiler01.wooditwork.com"),
                    ("vdi1_jptokfiler01","/vol/vdi1","jptokfiler01.wooditwork.com"),
                    ("vdi2_jptokfiler01","/vol/vdi2","jptokfiler01.wooditwork.com")}
      }
   }
    "NYC" {
      switch ($HostType) {
         "SRV" {$Datastores =       ("vmiso","/vol/vmiso1","usnycfas01.wooditwork.com"),
                    ("servers1_usnycfas01","/vol/servers1","usnycfas01.wooditwork.com")}
         "VDI" {$Datastores =       ("vmiso","/vol/vmiso1","usnycfas01.wooditwork.com"),
                    ("vdi1_usnycfas01","/vol/vdi1","usnycfas01.wooditwork.com"),
                    ("vdi2_usnycfas01","/vol/vdi2","usnycfas01.wooditwork.com")}
      }
   }
}

Write-Host "Build information has been generated" -ForegroundColor Cyan
Write-Host "------------------------------------" -ForegroundColor Cyan
Write-Host "   ESX(i) Host Name: " -NoNewline
Write-Host $VMHost -Separator "" -ForegroundColor Green
Write-Host "ESX(i) Host Version: " -NoNewline
Write-Host $ESXHostView.Config.Product.FullName -ForegroundColor Green
Write-Host "               Site: " -NoNewline
Write-Host $Site -ForegroundColor Green
Write-Host "          Host Type: " -NoNewline
Write-Host $HostType -ForegroundColor Green
Write-Host "       ISO Location: " -NoNewline
Write-Host $ISOLocation -ForegroundColor Green
Write-Host "      Search Domain:"$SearchDomain
Write-Host "        DNS Servers:"$DNSServers
Write-Host "        NTP Servers:"$NTPServers
Write-Host ""
If ($ESXProduct -eq "ESX") {
   Write-Host "ESX VMkernel Networking" -ForegroundColor Cyan
   Write-Host "-------------------" -ForegroundColor Cyan
   Write-Host "        VMkernel IP: " -NoNewline
   Write-Host $VMKernelIP -ForegroundColor Green
   Write-Host "      VMkernel VLAN:"$VMKernelVLAN
   Write-Host "      VMkernel Mask:"$VMKernelMask
   Write-Host "   VMkernel Gateway:"$VMKernelGateway
   Write-Host ""
}
Write-Host "vMotion Networking" -ForegroundColor Cyan
Write-Host "------------------" -ForegroundColor Cyan
Write-Host "         vMotion IP: " -NoNewline
Write-Host $VmotionIP -ForegroundColor Green
Write-Host "       vMotion Mask:"$VmotionMask
Write-Host ""
Write-Host "   Port Groups" -ForegroundColor Cyan
Write-Host "-----------" -ForegroundColor Cyan
ForEach ($PortGroup in $PortGroups) {
   Write-Host "         Port Group: "$PortGroup[0]"   VLAN:"$PortGroup[1]
}
Write-Host "Storage" -ForegroundColor Cyan
Write-Host "-------" -ForegroundColor Cyan
ForEach ($Datastore in $Datastores) {
   Write-Host -Separator "" "          Datastore: "$Datastore[0]" - "$Datastore[2]":"$Datastore[1]
}
Write-Host "---------------------------------------------------" -ForegroundColor Cyan
Write-Host "" -ForegroundColor Cyan

Write-Host "ESX(i) Host will be built with the generated information, " -NoNewline
Write-Host "Enter Y to proceed" -ForegroundColor Magenta
$a = read-host
$a = $a.ToUpper()
If ($a -ne "Y") {Write-Host "You have decided not to continue, Exiting" -ForegroundColor Red
   Disconnect-VIServer -Confirm:$False
   Exit
}

Write-Host "-----------------------------------------------" -ForegroundColor Cyan
Write-Host "Building ESX(i) Host:" $VMHost -ForegroundColor Cyan
Write-Host "-----------------------------------------------" -ForegroundColor Cyan

If ($ESXHost.ConnectionState -notmatch "Maintenance") {
   Write-Host "Putting Host into Maintenance Mode" -ForegroundColor Cyan
   Set-VMHost -State maintenance
}

Write-Host "Setting DNS Servers and Search Domains" -ForegroundColor Cyan
Get-VMHostNetwork | Set-VMHostNetwork -DnsAddress $DNSServers -SearchDomain $SearchDomain

If ($ESXProduct -eq "ESX") {
   Write-Host "Setting Console Memory" -ForegroundColor Cyan
   $ESXHostView | %{(Get-View -Id $_.ConfigManager.MemoryManager).ReconfigureServiceConsoleReservation($ConsoleMemory*1mb)}
}

Write-Host "Remove any existing NTP Servers" -ForegroundColor Cyan
If ((Get-VMHostNtpServer) -ne $Null) {Remove-VMHostNtpServer -NtpServer (Get-VMHostNtpServer) -Confirm:$false}

Write-Host "Adding NTP Servers" -ForegroundColor Cyan
$ESXHost | Add-VMHostNtpServer -NtpServer $NTPServers

If ($ESXProduct -eq "ESX") {
   Write-Host "Enabling SSH on the host" -ForegroundColor Cyan
   $ESXHost | Get-VmhostFirewallException "SSH Client" | Set-VMHostFirewallException -enabled:$true

   Write-Host "Enabling NTP Service in the firewall" -ForegroundColor Cyan
   $ESXHost | Get-VmhostFirewallException "NTP Client" | Set-VMHostFirewallException -enabled:$true
}

Write-Host "Starting/Restarting the NTP Service" -ForegroundColor Cyan
$NTPService = Get-VMHostService | Where-Object {$_.key -eq "ntpd"}

If ($NTPService.Running -eq $True)
   {Restart-VMHostService -HostService $NTPService -Confirm:$false}
else
   {Start-VMHostService -HostService $NTPService -Confirm:$false}

Write-Host "Setting the NTP Service Policy to Automatic" -ForegroundColor Cyan
$NTPService | Set-VMHostService -Policy Automatic

Write-Host "Removing any VM networks" -ForegroundColor Cyan
$ESXHost | Get-VirtualPortGroup | Where-Object {$_.Port -eq $Null} | Remove-VirtualPortGroup -Confirm:$False

Write-Host "Removing any empty Virtual Switches" -ForegroundColor Cyan
$ESXHost | Get-VirtualSwitch | Where-Object { $Null -eq (Get-VirtualPortGroup -VirtualSwitch $_)} | Remove-VirtualSwitch -Confirm:$False

Write-Host "Configuring vSwitch0" -ForegroundColor Cyan
$vSwitch0 = $ESXHost | Get-VirtualSwitch | where {$_.Name -like "vSwitch0"}

Write-Host "Setting the Port Number on vSwitch0" -ForegroundColor Cyan
$vSwitch0 | Set-VirtualSwitch -NumPorts $vSwitch0PortNumber -Confirm:$false

Write-Host "Add vmnic1 to vSwitch0" -ForegroundColor Cyan
$vSwitch0 | Set-VirtualSwitch -Nic vmnic0,vmnic1 -Confirm:$false

Write-Host "Enable Beacon Probing on vSwitch0" -ForegroundColor Cyan
$vSwitch0 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy BeaconProbing

If ($ESXProduct -eq "ESX") {
   Write-Host "Adding VMkernel Port Group" -ForegroundColor Cyan
   $VMkernel = $vSwitch0 | New-VirtualPortGroup -Name VMkernel -vlanid $VMkernelVLAN

   Write-Host "Adding the VMkernel IP Address" -ForegroundColor Cyan
   New-VMHostNetworkAdapter -PortGroup $VMkernel -VirtualSwitch $vSwitch0 -IP $VMkernelIP -SubnetMask $VMkernelMask

   Write-Host "Adding the VMkernel Gateway" -ForegroundColor Cyan
   Get-VMHostNetwork | Set-VMHostNetwork -VMkernelGateway $VMkernelGateway -VMkernelGatewayDevice "vmk0"

   Write-Host "Setting vmnic1 to an Active Adapter" -ForegroundColor Cyan
   $VMkernel | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -MakeNicActive "vmnic1"

   Write-Host "Setting vmnic0 to a Standby Adapter" -ForegroundColor Cyan
   $VMkernel | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -MakeNicStandby "vmnic0"

   Write-Host "Override the vSwitch failover order" -ForegroundColor Cyan
   $VMkernel | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -InheritFailoverOrder $false -InheritFailback $true -InheritLoadBalancingPolicy $true -InheritNetworkFailoverDetectionPolicy $true -InheritNotifySwitches $true
}

If ($ESXProduct -eq "ESXi") {
   Write-Host "Configuring Management Network" -ForegroundColor Cyan
   $MgmtNet = $vSwitch0 | Get-VirtualPortGroup -Name "Management Network"

   Write-Host "Setting vmnic1 to an Active Adapter" -ForegroundColor Cyan
   $MgmtNet | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -MakeNicActive "vmnic1"

   Write-Host "Setting vmnic0 to a Standby Adapter" -ForegroundColor Cyan
   $MgmtNet | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -MakeNicStandby "vmnic0"

   Write-Host "Override the vSwitch failover order" -ForegroundColor Cyan
   $MgmtNet | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -InheritFailoverOrder $false -InheritFailback $true -InheritLoadBalancingPolicy $true -InheritNetworkFailoverDetectionPolicy $true -InheritNotifySwitches $true
}

Write-Host "Creating the vMotion vSwitch1 and Port Group" -ForegroundColor Cyan
New-VirtualSwitch -Name "vSwitch1" -Nic vmnic2,vmnic3 | New-VirtualPortGroup -Name vMotion

Write-Host "Adding the vMotion VMkernel IP Address" -ForegroundColor Cyan
New-VMHostNetworkAdapter -PortGroup vMotion -VirtualSwitch vSwitch1 -IP $vmotionIP -SubnetMask $VmotionMask -VMotionEnabled $true

Write-Host "Enabling Beacon Probing on vSwitch1" -ForegroundColor Cyan
$vSwitch1 = Get-VirtualSwitch | where {$_.Name -like "vSwitch1"}
$vSwitch1 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy BeaconProbing

Write-Host "Creating Virtual Machine Port Groups" -ForegroundColor Cyan
$PortGroups | %{$vSwitch0 | New-VirtualPortGroup -Name $_[0] -vlanid $_[1]}

Write-Host "Setting VM Port Group Failover order" -ForegroundColor Cyan
$VMPortGroups = $vSwitch0 | Get-VirtualPortGroup | Where-Object {$_.Port -eq $Null}
foreach ($VMPortGroup in $VMPortGroups){
   Write-Host $VMPortGroup.Name ": Set vmnic0 to an Active Adapter"  -ForegroundColor Cyan
   $VMPortGroup | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -MakeNicActive "vmnic0"
   Write-Host $VMPortGroup.Name ": Set vmnic1 to a Standby Adapter"  -ForegroundColor Cyan
   $VMPortGroup | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -MakeNicStandby "vmnic1"
   Write-Host $VMPortGroup.Name ": Override the vSwitch failover order"  -ForegroundColor Cyan
   $VMPortGroup | Get-NicTeamingPolicy |  Set-NicTeamingPolicy -InheritFailoverOrder $false -InheritFailback $true -InheritLoadBalancingPolicy $true -InheritNetworkFailoverDetectionPolicy $true -InheritNotifySwitches $true
}

# Add site specific additional network requirements"
switch ($Site) {
   "TOK" {
      switch ($HostType) {
         "SRV" {
            Write-Host "Tokyo: Creating the DMZ vSwitch2 and Port Group" -ForegroundColor Cyan
            New-VirtualSwitch -Name "vSwitch2" -Nic vmnic6,vmnic7 | New-VirtualPortGroup -Name servers_dmz

            Write-Host "Enabling Beacon Probing on vSwitch2" -ForegroundColor Cyan
            $vSwitch2 = Get-VirtualSwitch | where {$_.Name -like "vSwitch2"}
            $vSwitch2 | Get-NicTeamingPolicy | Set-NicTeamingPolicy -NetworkFailoverDetectionPolicy BeaconProbing
         }
      }
   }
}

Write-Host "Setting NFS Advanced Host Configuration Settings" -ForegroundColor Cyan
Set-VMHostAdvancedConfiguration -VMHost $ESXHost -Name NFS.MaxVolumes  -Value 64 -Confirm:$false
Set-VMHostAdvancedConfiguration -VMHost $ESXHost -Name NFS.HeartbeatFrequency  -Value 12 -Confirm:$false
Set-VMHostAdvancedConfiguration -VMHost $ESXHost -Name NFS.HeartbeatMaxFailures  -Value 10 -Confirm:$false
Set-VMHostAdvancedConfiguration -VMHost $ESXHost -Name NFS.HeartbeatTimeout -Value 5 -Confirm:$false

Write-Host "Setting TCPIP Advanced Host Configuration Settings" -ForegroundColor Cyan
Set-VMHostAdvancedConfiguration -VMHost $ESXHost -Name Net.TcpipHeapSize -Value 30 -Confirm:$false
Set-VMHostAdvancedConfiguration -VMHost $ESXHost -Name Net.TcpipHeapMax -Value 120 -Confirm:$false

Write-Host "Mounting Datastores" -ForegroundColor Cyan
$Datastores | %{New-datastore -nfs -name $_[0] -path $_[1] -nfshost $_[2]}

Write-Host "Installing additional Network Patches" -ForegroundColor Cyan
If ($ESXProduct -eq "ESX") {
   switch ($ESXHost.Version) {
        "4.0.0" {
            Write-Host "Installing Patch: BCM-bnx2x-1.52.12.v40.8" -ForegroundColor Cyan
            Install-VMHostPatch -VMHost $ESXHost -HostPath /vmfs/volumes/$ISOLocation/ESXPatches/BCM-bnx2x-1.52.12.v40.8-offline_bundle-324481/metadata.zip
      }
      "4.1.0" {
            Write-Host "Installing Patch: BCM-bnx2x-1.60.50.v41.2" -ForegroundColor Cyan
            Install-VMHostPatch -VMHost $ESXHost -HostPath /vmfs/volumes/$ISOLocation/ESXPatches/BCM-bnx2x-1.60.50.v41.2-offline_bundle-320302/metadata.zip
            Write-Host "-----------------------------------------" -ForegroundColor Cyan
      }
    }
}

Write-Host "-----------------------------------------" -ForegroundColor Cyan
Write-Host "ESX Host Scripted Configuration complete." -ForegroundColor Green
Write-Host "Continue with VMware Update Manager Patching" -ForegroundColor Magenta
Write-Host "-----------------------------------------" -ForegroundColor Cyan

Disconnect-VIServer -Confirm:$False
  1. Jay Rogers
    July 14th, 2011 at 15:16 | #1

    download of presentation not working…

  2. WoodITWork
    July 15th, 2011 at 10:37 | #2

    @Jay Rogers
    Oops, thanks Jay…now corrected!

  1. No trackbacks yet.
 

Time limit is exhausted. Please reload the CAPTCHA.