Search This Blog

Fix “Failed to install the hcmon driver” Error on Windows 10 When Installing VMware Remote Console

  • Launch Windows PowerShell as Administrator
  • Change directory to the folder where the VMware-VMRC-xxx.msi is located
  • Execute .\VMware-VMRC-xxx.msi

VM Hard Disk’s VMDK Files

Each hard disk of a VM consists of two .vmdk files:

  • one is a text file (descriptor file) containing descriptive data about the virtual hard disk; the name of the file is myvm.vmdk
  • the second is the actual content of the disk; the name of the file is myvm-flat.vmdk

Normally when browsing the datastore in the vSphere Web or C# Client, only the first .vmdk file is showed, and the size of the file is showed the total of both .vmdk files. I used to mislead by this and thought only one .vmdk for each VM hard disk.

VMDK.1
only one .vmdk file is showed, and note its size and type

But when SSH to the ESXi host and list the content in the VM folder, both .vmdk files are showed.

VMDK.2

If you manually move the first .vmdk file to another folder using the vSphere Client (when the VM is powered off), the –flat.vmdk file will show in the datastore when browsing in the vSphere Client.

VMDK.3
moving the .vmdk file to a different folder

VMDK.4
after moving, the .vmdk file is at the new location, but its size and type are changed

VMDK.5
after moving, the –flat.vmdk file is showed at the original location. note its size and type

Calculate Annual Rate of Growth

Here is the method to calculate the annual rate of growth over a period of time, e.g. salary or investment. In the following formula, the beginning balance is A, after Y years, the ending balance is B.

  1. Calculate the percentage of change: B / A
  2. Divide one by the number of years: 1 / Y
  3. Calcualte the annul rate of growth: ( B / A ) ^ ( 1 / Y ) - 1
  4. Convert the number in #3 to percentage

For example, the begining balance is 5000, after 10 year, the ending balance is 6000.

The annual rate of growth in 10 years is ( 6000 / 5000 ) ^ ( 1 / 10 ) – 1 = 0.0184 = 1.84%

Downgrade Virtual Machine Hardware Version in vSphere

Each major release of VMware vSphere comes with a newer virtual machine hardware version that provides the latest features. In order to unlock these features in an existing VM, the VM needs to be migrated to the new ESXi host and upgrade its hardware version.

Upgrading a VM’s hardware version is simple: power off the VM; in the vSphere Web client, right-click on the VM and select Compatibility and Upgrade VM Compatibility.

Once its hardware version is upgraded, the VM cannot boot in the older ESXi host any more. To downgrade the hardware version, there are three options according to VMware KB1028019:

  • Revert to a snapshot created before upgrading the VM hardware version
  • Use VMware vCenter Converter Standalone and select the required VM hardware version in the Specify Destination wizard
  • Create a new VM with the required hardware version and attach the existing disk from the VM

I found the third option is the quickest way and provided a little more detail below.

  • (optional) Make a clone of the VM or template, if you want to keep a template for both the existing and previous hardware version
  • Gather the VM’s virtual hardware (CPU, Memory, Hard disks – including the name and location of each VMDK files, Controller Type, Network Adapter’s network and type, Guest OS and Version)
  • Remove the VM from inventory
  • Create a new VM
    • Select the required hardware version in Compatibility
    • VM.Hardware.Version.Downgrade.01
    • Select the guest OS and version to match the original VM
    • VM.Hardware.Version.Downgrade.02
    • Customize the CPU, Memory, Controller, Network Adapter type to match the original VM
    • Add a new existing hard drive and select the VMDK file to match the original VM
    • VM.Hardware.Version.Downgrade.03
  • Once the new VM is created, right-click on the VM and select Edit Settings and remove the first hard disk that is added by default
  • Here are the screenshots to show the hardware version before and after the downgrade
  • VM.Hardware.Version.Downgrade.04VM.Hardware.Version.Downgrade.05

Batch Script for Creating An User and Adding to Member of Local Administrators Group

I built a batch script to create a local user and add it to the local administrators group. The script requires two arguments – one is the user’s login name, another is the user’s full name. The user’s password is hard-coded, but it can be changed to an argument with a small modification.

@echo off
set PASSWORD=XXXXXXXXX

REM add a local user with password
net user %1 %PASSWORD% /add /fullname:%2

REM add a local user to the administrators group
net localgroup administrators %1 /add

One thing I learned is that not all options (e.g. /fullname) are showed when typing “net user /?”. For more other options, see this Technet document.

Using nmap to Test DNS Server Recursion

  1. Download nmap binaries. For Windows OS, download the command-line zipfile is sufficient.
  2. Unzip the zip file, and install Winpcap and Visual C++ Redistributable Package installer included in the zip file
  3. Open command prompt
  4. Run “nmap –sU –p53 –script=dns-recursion <DNS_Server_IP>
  5. If the server allows resursion, it shows “Recursion appears to be enabled”

To prevent the DNS server from being used for DNS amplification attacks, disable DNS recursion on the public facing DNS server. The DNS recursion should be enabled on the DNS server serving the internal client.

On a Windows DNS server, this can be done under the DNS server properties, Advanced tab, Server options, check the checkbox “Disable recursion (also disable forwarders)”

WinDNS.Disable.Recursion

Use Get-FolderItem.ps1 to Fix PathTooLongException

When using Get-ChildItem to list all files in a folder and its subfolders, it returns the “PathTooLongException” error. This happens when the file path is more than 260 characters.

There are several ways to work around this issue. See this Technet Wiki.

Personally, I found the Get-FolderItem.ps1 script is the easiest one.

  1. Download the script from Microsoft Script Center Repository
  2. Right-click on the script and select Properties, then click Unblock
  3. Launch a PowerShell session
  4. Load the Get-FolderItem function into the session by entering “. <path>\Get-FolderItem.ps1”. (make sure there is a space between the “.” and the script)
  5. Enter “Get-FolderItem –Path <path>” to list all files in the folder and its subfolders
  6. Another use case “Get-FolderItem –Path <path> | Where {$_.LastWriteTime –gt “MM/DD/YYYY” } | Select FullName | Ft –autosize | Out-File c:\temp\modified.file.log.txt –width 4096

For more information about the Get-FolderItem.ps1 script, see this.

Use WinSCP to Transfer Files in vCSA 6.7

This is a quick update on my previous post “ Use WinSCP to Transfer Files in vCSA 6.5 ”. When I try the same SFTP server setting in vCSA 6.7...