ESXi Builder 1.4 and other utility scripts (Configure ESXi from Factory Settings)

Version 8

    <b>New Version 1.4. Includes several changes. Didn't doc out as much as I'd like, but it's your to play with.</B><br>

    <b>Also - this should be called a Bundle...... Look under .\Utils to find a bunch of other scripts I wrote, including much help from the community, of course LucD.</b><br>

    <b>My own little script repository</b><br><br>

    <b>esxibuilder utility.</b><br>

    This script is currently designed to implement esxi configuration following power on of a server with the USB key from factory.<br>



    - host-template.ps1 # This file is used to define host specific variables passed to build.ps1, cluster.ps1, and host-report.ps1<br>

    - host-report.ps1 # Currently a pretty useless report to run against a host following the install.<br>

    - Builds\esxibuild.ps1 # This is the "buildscript" that configures most of the esx host. Typically not edited.<br>

    - Clusters\clus-template.ps1 # This is the cluster specific file that will create vswitch1. Edit this to name your portgroups.<br>

    - Logs\ # This is where Build and Report output is sent from each script execution<br>


    <b>What this Script is currently Setup To DO</b><br>

    - Resets the Root Password to a Prompted Value<br>

    - Changes the Hostname, GW, and Domain of the HOST<br>

    - Changes the IP Address of the Default Management VMK0 Interface on vSwitch0<br>

    - Add VMK Portgroup Named VMotion to vSwitch0, sets IP, Enables Vmotion<br>

    - Sets VLAN TAG for VMO <br>

    - Removes Default VM Network on vSwitch0<br>

    - Add VMNIC2 to vSwitch0 <br>

    - Sets ALL physical NICs to 1000/Full Duplex - Reconnects<br>

    - Mounts an NFS Volume if you want one.<br>

    - Sets NTP to two Servers (Thanks LBerc)<br>

    - Adds Server to default host folder on Virtual Center<br>

    - Puts the host into maintenance mode to prevent premature loading.<br>

    - Calls Cluster.ps1 with vSwitch1 build. Currently builds 1 switch called vSwitch1 with vmnic1,3,4,5 added and 1 Port Group.<br>

    - Runs a pretty useless report<br>

    - Writes a somewhat useful log while building.<br>

    - Reboots host at end<br>



    <b>Instructions SUmmary</B><br>

    1. Save to your folder or location on your VIToolkit enabled windows host.<br>

    2. Extract the contents.<br>

    3. Recommend making a copy of the existing host-template.ps1, clus-template.ps1, and esxibuild.ps1 files.<br>

    4. Copy and Edit the Cluster.ps1 file for each cluster - this configures common vSwitch1 VM Network Portgroups and tagging.<br>

    5. Copy and Edit the host-template.ps1 file for each host you plan to build, specify your ClusterFile in Each host-template.ps1<br>

    6. Ensure Pre-requisites are in place.<br>

    7. Execute your command from VIToolKit PS prompt by typing .\host-template.ps1 "DHCPADDRESSOFESX" <br>





    You may also edit and create different 'esxibuild.ps1' files to change the Host Characteristics.<br><br>



    <b>Details for host-template.ps1</b><br>


    $hostname = "<hostname>" <br>                              

    $vmkip = "<mgmt VMK IP>" # IP Address for "Management Network" VMK doing NFS and Management<br>

    $vmkmask = "<VMK MASK>" # Net Mask for VMK IP<br>

    $vmkgw = "<VMK GW IP>" # VMKernel Gateway - On same subnet as $vmkip<br>

    $vmoip = "<VMO IP>" # IP Address for VMotion Interface. 4th octet should match host number.<br>

    $domainname = "<domain>"<br>

    $vc = "<FQDN of VirtualCenter>" # The Virtual Center that the host will be Added To<br>

    $ntphosts = "<ntp1>", "<ntp2>" # NTP Servers<br>

    $ClusterFile = "<cluster.ps1>" ## Sets the Cluster profile located in .\Clusters\<br>

    $BuildFile = "<esxibuild.ps1>" ## Sets the build profile located in .\Builds\<br>

    $vmoVLanId = "<VLANTAG>"<br>

    $nfsmountname = "<datastorename>"<br>

    $nfspath = "</nfspath>"<br>

    $nfshost = "<nfshost>"<br>



    <b>Details for clus-template.ps1</b><br>

    Edit the following for each cluster or vSwitch1 profile<br>

    $MyvSwitchName = "vSwitch1"<br>

    $MynumPorts = 56<br>

    $MyPortGroupName = "<portgroupname>"<br>

    $MyPortGroupName2 = "<portgroupname>"<br>

    $MyvlanID = <VLANTAG><br>

    $MyvlanID2 = <VLANTAG><br>

    $MyNICs = "vmnic1", "vmnic3", "vmnic4", "vmnic5"<br>



    There is quite a bit more than can and will be done to this setup. you can email me at if you'd like to modify / add or what ever.<br>



    <b>### Issues</b> <br>

    NTP isn't set to automatically start with host. Following the reboot at the end of the script, NTP will not be running. Looking into changing that.<br>