Script for unattended esxi installation using ftp server | KickStart script


You can use scripts for unattended ESXi installation or upgrade, scripted installations or upgrades provide an efficient way to deploy multiple hosts.


The installation or upgrade script contains the installation settings for ESXi. You can apply the script to all hosts that you want to have a similar configuration.


For a scripted installation or upgrade, you must use the supported commands to create a script. You can edit the script to change settings that are unique for each host.


The installation or upgrade script can reside in one of the following locations:


FTP server

HTTP/HTTPS server

NFS server

USB flash drive

CD-ROM drive

In my lab I am keeping the installation script in FTP and HTTP server.


You can download the script from below link and save the script win KS.CFG

http://www.mytechinfoit.com/2022/04/script-to-automate-esxi-deployment.html 


Steps to configure FTP server.


Login to server

Go to server manager

Add Roles and features -> Follow the screen

Check web server IIS

FTP server

Select FTP service



Click next and follow the screen and install

Once installation complete

Open IIS manager




Right click on site and click Add  FTP site


Give the FTP site name

In content directory give the physical location of script file

I have kept script file in c:\esxi folder



Click next 

Select IP address to bind the address, in my Lab setup I am using single IP, if there is multiple assigned on the server then it will show in list


Select No SSL



In Authentication type

Select Anonymous

And anonymous users


In permission 

Select Read


Then click finish

Now select newly created FTP site SK-CFG

Click FTP authentication and enable Anonymous authentication if it is not already enabled

Once you enable it then anyone can access this FTP content without login.



Also click on FTP authorization rule to recheck whether anonymous users are allowed or not



Now go to the client machine and check whether FTP is working or not.

Open browser and enter FTP path-> ftp://192.168.1.16/ 


Now FTP page is opening without entering any user ID or password


Steps to install unattended ESXI 


If you are using physical server for deployment, then mount ESXI ISO and boot the server using CD/DVD

And follow below steps, in my case I am deploying ESXi in VMware workstation.

Steps will be the same for both Physical and Virtual only, the booting process will be different.


For a physical server you need to launch iLO console and mount ISO and boot from there.

In the VMware workstation we need to edit the VM setting and assign the ISO path and boot the server.



Once you will boot the server using ISO at first boot press SHIFT=O to edit boot options 





Now enter FTP address one temp IP to communicate with the FTP server like below.



Press enter.

Now installation has started


Post installation server will auto reboot and do the entire configuration that has been updated in the script.

Finally installation completed with the same configuration that had updated in script file.



Thank you!!!!











Script to automate ESXI deployment

 ################################################

## vSphere ESXi 7.0 Scripted Install - Part 1 ##

################################################

# Accept the VMware End User License Agreement

vmaccepteula


# Set the root password for DCUI

rootpw Passw0rd!!


# Install on the first local disk available on machine

install --firstdisk --overwritevmfs


# Set the network to Static on the first network adapter

network --hostname=esxi7-Auto --device=vmnic0 --bootproto=static --ip=192.168.1.215 --netmask=255.255.255.0 --gateway=192.168.1.1 --nameserver=192.168.1.16


# Reboot

reboot


################################################

## vSphere ESXi 7.0 Scripted Install - Part 2 ##

################################################


# Use busybox interpreter

%firstboot --interpreter=busybox


# Set DNS Suffix

esxcli network ip dns search add --domain=ads.com


# Disable IPv6

esxcli network ip set --ipv6-enabled=false


# Enable SSH

vim-cmd hostsvc/enable_ssh

vim-cmd hostsvc/start_ssh


# Enable NTP

echo "server 0.au.pool.ntp.org" >> /etc/ntp.conf;

echo "server 1.au.pool.ntp.org" >> /etc/ntp.conf;

/sbin/chkconfig ntpd on;


# Create vSwitches

esxcli network vswitch standard add -v vSwitch1

esxcli network vswitch standard add -v vSwitch2


# Set vSwitch MTU's

esxcli network vswitch standard set -v vSwitch1 -m 9000

esxcli network vswitch standard set -v vSwitch2 -m 9000


# Add Additional NIC to vSwitches

esxcli network vswitch standard uplink add --uplink-name=vmnic1 --vswitch-name=vSwitch0

esxcli network vswitch standard uplink add --uplink-name=vmnic2 --vswitch-name=vSwitch1

esxcli network vswitch standard uplink add --uplink-name=vmnic3 --vswitch-name=vSwitch1

esxcli network vswitch standard uplink add --uplink-name=vmnic4 --vswitch-name=vSwitch2

esxcli network vswitch standard uplink add --uplink-name=vmnic5 --vswitch-name=vSwitch2


# Create VMKernel Ports

esxcli network vswitch standard portgroup add --portgroup-name=vMotion --vswitch-name=vSwitch1

esxcli network vswitch standard portgroup add --portgroup-name=NFS --vswitch-name=vSwitch2

esxcli network ip netstack add --netstack=vmotion

esxcli network ip interface add --interface-name=vmk1 --portgroup-name=vMotion --netstack=vmotion --mtu=9000

esxcli network ip interface add --interface-name=vmk2 --portgroup-name=NFS --mtu=9000

esxcli network ip interface ipv4 set --interface-name=vmk1 --ipv4=192.168.10.215 --netmask=255.255.255.0 --type=static

esxcli network ip interface ipv4 set --interface-name=vmk2 --ipv4=192.168.5.215 --netmask=255.255.255.0 --type=static


# Put host in maintenance mode

esxcli system maintenanceMode set -e true


# Reboot to apply settings (disabling IPv6)

esxcli system shutdown reboot -d 15 -r "rebooting after disabling IPv6"

Steps to customize windows start layout and taskbar using group policy

 Steps to customize windows start layout and taskbar using group policy


To prepare a Start layout for export, you simply customize the Start layout on a test computer.

To prepare a test computer

Set up a test computer on which to customize the Start layout. Your test computer should have the operating system that is installed on the users’ computers. Install all apps and services that the Start layout should display.


Create a new user account that you will use to customize the Start layout.


To customize Start


Sign in to your test computer with the user account that you created.


Customize the Start layout as you want users to see it by using the following techniques:


Pin apps to Start. From Start, type the name of the app. When the app appears in the search results, right-click the app, and then click Pin to Start.


To view all apps, click All apps in the bottom-left corner of Start. Right-click any app, and pin or unpin it from Start.


Unpin apps that you don’t want to display. To unpin an app, right-click the app, and then click Unpin from Start.


Drag tiles on Start to reorder or group apps.


Resize tiles. To resize tiles, right-click the tile and then click Resize.


Create your own app groups. Drag the apps to an empty area. To name a group, click above the group of tiles and then type the name in the Name group field that appears above the group.


Initial start layout and task manager setting on my test machine “Database



Now you need to pin/unpin from start and taskbar as per your requirements.


Here I have pined application in start menu and taskbar as per my requirement in my test machine “Database



Now launch PowerShell

Run below command to generate start layout .xml file

You can export application path using


AppUserModelID or DesktopApplicationLinkPath 

It depends on the OS where you are running this script.


Export-StartLayout -Path C:\Temp\startlayout010422.xml 





Now go to machine open gpedit.msc


Local Computer Policy -> Computer Configuration ->Administrative Templates -> Start Menu and Taskbar -> 


Double click on Start Layout -> Enable and enter .xml file path




If you want to configure for User only then you need to select User configuration -> Administrative Templates -> Start Menu and Taskbar -> 


Double click on Start Layout  -> Enable and enter .xml file path


Run Gpupdate /force and restart the machine and try with any local user.

Once this policy is implemented, users can’t customize the Start layout.


To configure taskbar in windows you need to do some modification in existing .xml file


Add xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" to the first line of the file, before the closing >


Like below


Use below layout setting between 

</DefaultLayoutOverride>


</LayoutModificationTemplate>

And add DesktopApplicationLinkPath with application name .ink in between like below


<CustomTaskbarLayoutCollection>

      <defaultlayout:TaskbarLayout>

        <taskbar:TaskbarPinList>

          <taskbar:UWA AppUserModelID="Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" />

          <taskbar:DesktopApp DesktopApplicationLinkPath="%APPDATA%\Microsoft\Windows\Start Menu\Programs\System Tools\File Explorer.lnk" />

        </taskbar:TaskbarPinList>

      </defaultlayout:TaskbarLayout>

    </CustomTaskbarLayoutCollection>




Save the .xml file and again run gpupdate /force and check with any local user.

Now the same taskbar and start layout will apply to all users.


Thanks!!!!





VM failing to powered ON | Module ‘Monitorloop’ power on failed | Current swap file size is 0 KB | Failed to extend swap file

 When you are powering on the VM and getting below error what do you need to do?

Error code

Module ‘Monitorloop’ power on failed

Failed to extend the virtual machine swap file

Current swap file size is 0 KB

Failed to extend swap file /vmfs/volumes/******



Login to ESXI host where you are getting above error 

Run below command to check list of VM VMs on the ESXi host

vim-cmd vmsvc/getallvms



Now you need to go to the failed VM director using cd command.

cd /vmfs/volumes/SHARED-DATASTORE01/DEMOPRDSRM01

Note: - SHARED-DATASTORE01 ->Datastore name where failed VM is residing 

              DEMOPRDSRM01 -> Failed VM name

Now use “ls” to list out files



Now use ->   vi vmware.log (To read vmware.log file)



Now search for the error when it was failing to power on and you'll see something similar like whatever you were seeing in vCenter but in the easiest way. Like below

 


Now you need to check the free space on Datastore where your VM is running.

To check the free space on Datastore run the below command

vmkfstools -Ph /vmfs/volumes/SHARED-DATASTORE01   (P in caps and Datastore name)


Now only 719 MB free space available on Datastore, at least 1 GB free space is required to power ON the VM



Now run below command to check which file is taking more space.

Go inside the Datastore and run 

du -h command




Now you need to decide if you can delete any of the VMs from the Datastore to free up the space

If you want to delete any VM from the Datastore run below command.

/vmfs/volumes/61892dcd-b0d3dd11-0852-000c29b75dac] rm -rf /vmfs/volumes/SHARED-DATASTORE01/DEMOPRDSRM01


 Next time when you shall power on the VM it will power on.


Note-: You can manage Datastore space from the web console as well to free up the space.

 


How to fix if ESXi host is showing Not responding in vCenter | Reset management agent using DCUI | vpxa service restart in ESXi host

 How to fix if ESXi host is showing Not responding in vCenter

Below steps you need to check

Scenario 1 -> if the host is reachable and there is no lockdown mode enabled at host level.

  1. Ping the host

C:\Users\administrator>ping 192.168.1.51

Pinging 192.168.1.51 with 32 bytes of data:

Reply from 192.168.1.51: bytes=32 time<1ms TTL=64

Reply from 192.168.1.51: bytes=32 time<1ms TTL=64

  1. Login to host using web client -> If everything is fine start SSH service.

Login to ESXi host using putty console

Check VPXA service using below command

etc/init.d/vpxa status



Start the service using below command

etc/init.d/vpxa start



Now go to vCenter and check the status, it will take 2-3 minutes to sync.



  1. Scenario -> In case lockdown mode is enabled on ESXI host level 


As the lockdown mode is enabled on ESXi host level so you can’t connect using Webclient directly.


Login to iLO console -> Take remote console




Press F2 to login to host using DCUI with root credential





Go to troubleshooting options



Restart management agent



Press F (11) to restart management agent




Now management agent is restarting





Now go to vCenter and wait for 3-4 minutes to sync



VMware Command to check vpxa, hostd service status | start stop the vpxa & hostd service | 503 Service Unavailable (Failed to connect to endpoint

 Command to check vpxa, hostd service status | start stop the vpxa & hostd service


Login to ESXi host using putty session



Go to /etc/init.d/ and enter the service name and action type i.e status, start or stop


-> To terminate the service

[root@DEMOESX01:~] /etc/init.d/vpxa stop   

watchdog-vpxa: Terminating watchdog process with PID 526649

vpxa stopped.


-> To check the status

[root@DEMOESX01:~] /etc/init.d/vpxa status  

vpxa is not running


-> To start the service

 [root@DEMOESX01:~] /etc/init.d/vpxa start  

vpxa started.



If you are getting below error while accessing ESXI host

503 Service Unavailable (Failed to connect to endpoint: [N7Vmacore4Http16LocalServiceSpecE:0x00000000b6b48c80] _serverNamespace = / action = Allow _port = 8309)



Login to putty session



Check host d service status using below command

etc/init.d/hostd status



Start the host d service using below command

etc/init.d/hostd start



Now check ESXi host web console





Featured Post

HPE MSA 2040 configuration step by step

HPE MSA 2040 configuration Default IP range for HP SAN storage MSA 2040 is 10.0.0.1/2 You need to connect your laptop and storage with...