How to Enable SNMP on VMware ESXi 6.5 with esxcli

To enable SNMP on a VMware ESXi 6.5 host, connect to it with your favorite SSH client (I use PuTTY) and run the following commands:

esxcli system snmp set --communities public
esxcli system snmp set --enable true
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all true
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
/etc/init.d/snmpd restart

What each step does:

  • Sets the SNMP community string (replace public with your own).
  • Enables the SNMP agent.
  • Allows all IPs through the ESXi firewall’s SNMP ruleset, then enables that ruleset.
  • Restarts the SNMP service so the changes take effect.

If you copy these commands, make sure the options begin with two hyphens (--), not a single dash. Related: enabling SNMP on a Raspberry Pi.

Using Sysprep Instead of QuickPrep with VMware View Desktop Pools

Sometimes you need Sysprep instead of QuickPrep when creating a VMware View linked-clone desktop pool, usually because legacy software requires a unique local security identifier (SID) on every desktop. I was recently asked about it because an older antivirus product needed unique SIDs to centrally manage its in-OS agents.

The two customization methods are compared in the View Administration Guide (pages 95–96), and VMware KB 2003797 sums up the differences:

QuickPrep vs. Sysprep

FunctionQuickPrepSysprep
Removing local accountsNoYes
Changing Security Identifiers (SID)NoYes
Removing parent from domainNoYes
Changing computer nameYesYes
Joining the new instance to the domainYesYes
Generating new SIDNoYes
Language, regional settings, date, and time customizationNoYes
Number of reboots01 (seal & mini-setup)
Requires configuration file and SysprepNoYes

High-Level Steps

  1. Copy the Sysprep files to the vCenter Server. This is only needed for Windows XP; Windows 7 includes Sysprep. Details are in VMware KB 1005593.
  2. Create a guest customization specification in vCenter.
  3. Add a desktop pool that uses Sysprep with that customization specification.

Create a Guest Customization Specification

In vCenter, open Home → Customization Specification Manager, click New, and enter a name on the Properties page. Do not use a custom Sysprep answer file.

Customization specification Properties page in vCenter

Continue to the Computer Name page and set it to use the virtual machine name. Then enter your license key, administrator password, time zone, and so on until you reach the Network page.

Leave the network at the default Typical settings so the desktops use DHCP.

Network page set to typical settings (DHCP)

Leave the Workgroup or Domain page at its default. Anything entered here is ignored; the VM joins the domain using the guest customization settings in the View pool instead.

Workgroup or Domain page left at default

On the final Operating System Options page, make sure Generate New Security ID (SID) is checked. Unique SIDs are the whole reason we’re using Sysprep. Then finish the wizard.

Generate New Security ID (SID) option checked

Add the Desktop Pool

In View Manager, add a desktop pool as usual. The only difference from QuickPrep is on the final Guest Customization page:

  • Select the Domain. This list (usually just one entry) comes from the domains you defined for View Composer when you configured vCenter in View Administrator. It controls which domain the linked clones join and which credentials are used.
  • Select the Active Directory container as normal.
  • Choose Use a customization specification (Sysprep) and select the spec you created.
View pool Guest Customization page using a Sysprep customization specification

Finish the wizard and the pool will deploy. Provisioning is a bit slower than with QuickPrep because each linked clone needs an extra reboot.

What Happens When View Customizes with Sysprep

  1. Once the linked clone disks are created, View Manager puts the VM into the Customizing state.
  2. View Manager calls the vCenter API customizeVM_Task to apply the customization specification.
  3. View Manager powers on the linked clone.
  4. Inside the guest, the View Composer Agent sees it’s starting for the first time and calls NetJoinDomain with the machine password cached on the internal disk.
  5. The machine is now joined to the domain.
  6. Sysprep runs inside the guest.
  7. The View Composer Agent waits for Sysprep to finish, then tells the View Agent customization is complete, and the View Agent notifies the View Manager server.
  8. View Manager powers off the clone and snapshots it in its customized state, which becomes the refresh point.
  9. View Manager marks the linked clone Provisioned. When powered on, it moves to Available.