ESX Virtualization

VMware ESXi, vSphere, VMware Backup, Hyper-V... how-to, videos....

Nakivo Backup and Replication - #1 Backup solution for Virtual, physical, cloud, NAS and SaaS

Menu
  • Certification
      • VCP-DCV vSphere 8
          • vcp2024-125.
        • Close
    • Close
  • VMware
    • Configuration Maximums
    • vSphere
      • vSphere 8.0
      • vSphere 7.0
      • vSphere 6.7
      • vSphere 6.5
      • vSphere 6.0
      • Close
    • VMworld
      • VMware EXPLORE 2024
      • VMware EXPLORE 2023
      • VMware EXPLORE 2022
      • VMworld 2019
      • VMworld 2018
      • VMworld 2017
      • VMworld 2016
      • VMworld 2015
      • VMworld 2014
      • VMworld 2013
      • VMworld 2012
      • VMworld 2011
      • Close
    • Close
  • Microsoft
    • Windows Server 2012
    • Windows Server 2016
    • Windows Server 2019
    • Close
  • Categories
    • Tips – VMware, Microsoft and General IT tips and definitions, What is this?, How this works?
    • Server Virtualization – VMware ESXi, ESXi Free Hypervizor, VMware vSphere Server Virtualization, VMware Cloud and Datacenter Virtualization
    • Backup – Virtualization Backup Solutions, VMware vSphere Backup and ESXi backup solutions.
    • Desktop Virtualization – Desktop Virtualization, VMware Workstation, VMware Fusion, VMware Horizon View, tips and tutorials
    • How To – ESXi Tutorials, IT and virtualization tutorials, VMware ESXi 4.x, ESXi 5.x and VMware vSphere. VMware Workstation and other IT tutorials.
    • Free – Free virtualization utilities, ESXi Free, Monitoring and free backup utilities for ESXi and Hyper-V. Free IT tools.
    • Videos – VMware Virtualization Videos, VMware ESXi Videos, ESXi 4.x, ESXi 5.x tips and videos.
    • Home Lab
    • Reviews – Virtualization Software and reviews, Disaster and backup recovery software reviews. Virtual infrastructure monitoring software review.
    • Close
  • Partners
    • NAKIVO
    • StarWind
    • Zerto
    • Xorux
    • Close
  • This Web
    • News
    • ESXi Lab
    • About
    • Advertise
    • Archives
    • Disclaimer
    • PDFs and Books
    • Close
  • Free
  • Privacy policy

Avoiding the VMware Compliance Checker Headache – PowerCLI to the rescue.

By Andy | Last Updated: December 17, 2020

Shares

Avoiding the VMware Compliance Checker Headache – PowerCLI to the rescue.

This is a guest post by Andy Grant.

In Vladan's post Free compilance checker for VMware vSphere he introduced one of VMware's free audit and compliance tools.  This can be a great way to kick-start a discussion with your Information Assurance (security) department regarding the virtues of virtual infrastructure security.   Being proactive in managing all aspects of a virtual environment sure beats having your boss walk into your office with an audit report and demand answers for questions not previously asked 🙂

Short of running the VMware HealthAnalyzer, VMCC provides a quick and easy way to better understand the security implications of your system designs.  One of the challenges after running the audit scan is that many changes require configuration at the individual VM level.  In any enterprise environment, if the corrective actions cannot be scripted then you are in for a headache.  Thankfully we have PowerCLI to the rescue.

While I must admit that I have never been very good at coding or scripting, I forced myself to begin learning PowerCLI to manage the ever-growing vSphere environments that I am involved in.  I can whole-heartily recommend the book VMware vSphere PowerCLI Reference written in part by VMware Communities member LucD.

Not wanting to edit the .VMX file of every VM in the environment, I began searching for alternatives to entering configuration parameters.  Cracking open the PowerCLI Reference book to Chapter 12 provided a great code example to use to automate this procedure.  The book provided the example of VMX01 from the Hardening Guide.  I would actually recommend reviewing both Hardening Guides for all VM configuration options that the VMCC covers.

The VMware vSphere 4.0 Security Hardening Guide & the VMware vSphere 4.1 Security Hardening Guide.
Using the example script and the hardening guides I added all the VM options audited by VMCC to come up with the following;

# Connect to vCenter

$vCenter = Read-Host “Enter your vCenter servername”

Connect-VIServer $vCenter -Protocol HTTPS

$targetcluster = Read-Host “Enter the target cluster”

# Set up the VirtualMachineConfigSpec object

$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

# Add new options as necessary

# —————————–

# VMX01 Prevent virtual disk shrinking

$VMX01a = New-Object VMware.Vim.OptionValue

$VMX01a.Key = “isolation.tools.diskShrink.disable”

$VMX01a.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX01a

$VMX01b = New-Object VMware.Vim.OptionValue

$VMX01b.Key = “isolation.tools.diskWiper.disable”

$VMX01b.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX01b

# VMX02 – Prevent other users from spying on administrator remote consoles

$VMX02 = New-Object VMware.Vim.OptionValue

$VMX02.Key = “RemoteDisplay.maxConnections”

$VMX02.Value = “1”

$vmConfigSpec.ExtraConfig += $VMX02

# VMX03 – Disable copy/paste to remote console

$VMX03a = New-Object VMware.Vim.OptionValue

$VMX03a.Key = “isolation.tools.copy.disable”

$VMX03a.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX03a

$VMX03b = New-Object VMware.Vim.OptionValue

$VMX03b.Key = “isolation.tools.paste.disable”

$VMX03b.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX03b

$VMX03c = New-Object VMware.Vim.OptionValue

$VMX03c.Key = “isolation.tools.dnd.disable”

$VMX03c.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX03c

$VMX03d = New-Object VMware.Vim.OptionValue

$VMX03d.Key = “isolation.tools.setGUIOptions.enable”

$VMX03d.Value = “FALSE”

$vmConfigSpec.ExtraConfig += $VMX03d

# VMX11 – Prevent unauthorized removal, connection and modification of devices.

$VMX11a = New-Object VMware.Vim.OptionValue

$VMX11a.Key = “isolation.device.connectable.disable”

$VMX11a.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX11a

$VMX11b = New-Object VMware.Vim.OptionValue

$VMX11b.Key = “isolation.device.edit.disable”

$VMX11b.Value = “TRUE”

$vmConfigSpec.ExtraConfig += $VMX11b

# VMX12 – Disable VM-to-VM communication through VMCI

$VMX12 = New-Object VMware.Vim.OptionValue

$VMX12.Key = “vmci0.unrestricted”

$VMX12.Value = “FALSE”

$vmConfigSpec.ExtraConfig += $VMX12

# VMX20 – Limit virtual machine log file size and number.

$VMX20a = New-Object VMware.Vim.OptionValue

$VMX20a.Key = “log.rotateSize”

$VMX20a.Value = “1000000”

$vmConfigSpec.ExtraConfig += $VMX20a

$VMX20b = New-Object VMware.Vim.OptionValue

$VMX20b.Key = “log.keepOld”

$VMX20b.Value = “10”

$vmConfigSpec.ExtraConfig += $VMX20b

# VMX21 – Limit informational messages from the virtual machine to the VMX file.

$VMX21 = New-Object VMware.Vim.OptionValue

$VMX21.Key = “tools.setInfo.sizeLimit”

$VMX21.Value = “1048576”

$vmConfigSpec.ExtraConfig += $VMX21

$cluster = Get-Cluster $targetcluster | Get-VM | %{

$_.Extensiondata.ReconfigVM($vmConfigSpec)

}

Use this code to set the VMX options audited by the VMware Compliance Checker.  Please note that the configuration parameters will not take effect immediately.  You will need to power-off then power-on every single VM, a reset will not do.  You will be able to confirm that the settings have been entered by viewing the Advanced Parameters of the VM.
So there you have it, using PowerCLI we can modify the .VMX parameters of our Virtual Machines to simplify and automate our configuration tasks.
Shares
Vote !

| Filed Under: Server Virtualization Tagged With: Compliance Checker, PowerCLI, VMware PowerCli

Comments

  1. Edwin Hayes says

    June 2, 2011 at 3:32 pm

    Nice list. We have to update our current checks with the new items listed in the April version of the vSphere Hardening Guide. Just figured out how to check VMX56 which in our case should result in a null value.

    $dvfbIP = get-vmhostadvancedconfiguration -vmhost esx1
    $dvfbIP.Get_Item(“Net.DVFilterBindIpAddress”)

    • Andy says

      June 2, 2011 at 4:40 pm

      Thanks for the addition Edwin.  I just focused on the immediate VM options audited by the VMCC, but it can definitely be extended for other host and VM options specific to your environment.

  2. karlochacon says

    June 2, 2011 at 12:23 pm

    great script….I will be using very often

  3. karlochacon says

    June 2, 2011 at 6:09 pm

    great idea we should get help from the vmware community to get all the powercli checks done

Private Sponsors

Featured

  • Thinking about HCI? G2, an independent tech solutions peer review platform, has published its Winter 2023 Reports on Hyperconverged Infrastructure (HCI) Solutions.
  • Zerto: One Platform for Disaster Recovery, Backup & Cloud Mobility: Try FREE Hands-On Labs Today!
Click to Become a Sponsor

Most Recent

  • FREE version of StarWind VSAN vs Trial of Full version
  • Commvault’s Innovations at RSA Conference 2025 San Francisco
  • VMware ESXi FREE is FREE again!
  • Installation of StarWind VSAN Plugin for vSphere
  • Protect Mixed environments with Nakivo Physical Machine recovery (bare metal)
  • No more FREE licenses of VMware vSphere for vExperts – What’s your options?
  • Tails – Your Private OS on USB Stick
  • StarWind V2V Converter Now has CLI
  • Veeam VHR ISO v2 – 2025 Download and Install
  • Deployment OVA and Installation of Nakivo Backup and Replication for VMware

Get new posts by email:

 

 

 

 

Support us on Ko-Fi

 

 

Buy Me a Coffee at ko-fi.com

Sponsors

Free Trials

  • DC Scope for VMware vSphere – optimization, capacity planning, and cost management. Download FREE Trial Here.
  • Augmented Inline Deduplication, Altaro VM Backup v9 For #VMware and #Hyper-V – Grab your copy now download TRIAL.

VMware Engineer Jobs

VMware Engineer Jobs

YouTube

…

Find us on Facebook

ESX Virtualization

…

Copyright © 2025 ·Dynamik-Gen · Genesis Framework · Log in