Friday, April 28, 2017

Windows Server 2016: How to enable vTPM and Bitlocker on a Hyper-V VM

In a perfect world, all Hyper-V instances would be running on a Guarded Fabric with Host Guardian Service and Shielded VMs enabled. Unfortunately, for smaller environments and branch offices this may be overkill or cost prohibitive.

This is specially true given that Windows Server 2016 - Datacenter Edition is required for Shielded VMs.

That said, to add a layer of protection to your Server 2016 VMs, you can enable vTPM and Bitlocker.  With Windows Server 2016 Hyper-V, you can enable a Virtual Trusted Platform Module 2.0 (vTPM) on a VM.  The cool thing is, the physical Hyper-V host does NOT need to have TPM.

With the vTPM now enabled, you can enable BitLocker within your VM.  The VM can how be placed in a Remote Office or hosted infrastructure without worrying about the VM files being stolen or copied.

Lets get started:

1. Gracefully shutdown the VM and enable vTPM

2. Power on the VM and confirm that the vTPM has been installed.

Alternatively, you can run the following command on the host running the VM: get-vmsecurity myvm

3. Enable BitLocker within the VM by running the following command: Install-WindowsFeature -Name BitLocker -IncludeAllsubfeature -IncludeManagementTools

Restart the server.

4. Enable BitLocker within the VM
Testing:

1. The vhdx was copied to another instance of Hyper-V .  A fresh VM has created around this vhdx file.  Upon power on, it requested the recovery Key.  The Key was entered and the Vm started up as expected. 

2. Next, the entire VM folder was copied to another Hyper-V instance.  The Import Virtual Machine option was used.  “Register the virtual machine in-place (use the existing unique ID)” selected.  I received the following error and it immediately powered off.


3. Finally, I attached the vhdx to the host running the VM and placed it online.

I was unable to access the contents of the drive.

Additional Notes:  In the event that a VM needs to permanently move hosts, I confirmed that turning Bitlocker off, enabling vTPM, then re-enabling BitLocker allowed the VM to boot up normally. 


Windows Server 2016: How to Enable Nested Virtualization

YES, you can run LINUX within the nested Hyper-V instance!

Requirements and limitations at the time of this post:
  • VMs must be running Windows Server 2016 or Windows 10 Anniversary Update. 
  • VMs must be running versions 8.0 or above.
  • The host processors must support Intel VT/AMD-V and Intel XD/AMS NX.  To confirm your server meets these requirements, run "systeminfo" BEFORE installing the Hyper-V roll

1. Create the VM which will run the Hyper-V Role.  For testing, I used Server 2016 Standard Edition with Desktop Experience.  See requirements above.

2. Confirm the newly created VM is powered off and run the following command on the physical Hyper-V host to enable the Virtualization Extensions on the VM:

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true



3. Power on the VM and enable the Hyper-V role by running the following commandlet:

Install-WindowsFeature -Name Hyper-V -ComputerName <computer_name> -IncludeManagementTools -Restart

4. Confirm that the role has been installed successfully by running the get-windowsfeature command.

5. Networking must now be setup.  There are two options:
     A. MAC Address Spoofing
     B. Network Address Translation (NAT)

For testing, I chose to go the MAC spoofing route.  Run the following command on the physical host:

Get-VMNetworkAdapter -VMName <VMName> | Set-VMNetworkAdapter -MacAddressSpoofing On


6. From within the Hyper-V VM, create a new Virtual Switch:

7. This particular VM was only configured with a single vNic,  Confirm that "Allow management OS to share this network adapter" is checked.

8. Create a new VM within the nested Hyper-V instance.  For testing I like to use the TinyCore version of Tiny Core Linux.   Create it using Generation 1 hardware, the Virtual Switch created above and select the "Install an OS from bootable CD/DVD-Rom".

http://www.tinycorelinux.net/downloads.html

TCL can be found in .ova format in the following thread:
https://communities.vmware.com/docs/DOC-21621

It takes very little resources and has a basic graphical interface.   Here, I confirmed networking has been configured properly by pinging the gateway of the local LAN:


Enjoy your new found testing options!

Friday, April 21, 2017

How to View Your VMware Platform Services Controller (PSC) Configuration

Ever wondered what the sites and replication partners of your PSC are?  The easiest way to view these settings and others of your VMware PSC is by using the JXplorer product.  The application can be found here:

http://jxplorer.org/downloads/users.html

Select and install the appropriate client for your environment.   I chose Base JXplorer for Windows.

Launch the JXplorer application and select File > Connect
Enter your PSC information.  

EX.
Host: SSO_node.domain.local or psc1.domain.local
Protocol: 
LDAPv3
Port: 
11711 for vSphere 5.5 or 389 for vSphere 6.0
Base DN: 
dc=vsphere,dc=local
Level: 
User + Password
User DN: 
cn=Administrator,cn=Users,dc=vsphere,dc=local


Once you have successfully connected, you can quickly and easily view your sites and replication partners.


Thursday, March 30, 2017

How to patch a standalone ESXi 6.5 host

We received an email from Homeland Security regarding a severe vulnerability in ESXi that could allow a guest to execute code on an ESXi host. VMSA-2017-0006

http://www.vmware.com/security/advisories/VMSA-2017-0006.html


Patching is swift and easy using VMware Update Manager.  However, I recently stood up a standalone vSphere Hypervisor 6.5 host for testing.

For the record, ESXi patches are cumulative.

Here are the steps I took to patch this host.

1. Download applicable patches (Log in required).
http://www.vmware.com/patchmgr/download.portal 

Edit:  On Jan 10th 2018, I had to use the following link:

2. Upload the patches into the local datastore of the host you wish to patch.   I placed them in a folder called "patches" in the datastore:

3. Place the host in Maintenance Mode.

4. Enable ESXi Shell/SSH and log into the server.

5.  Run the following command for each patch to be installed:
esxcli software vib install -d "/vmfs/volumes/Datastore/DirectoryName/PatchName.zip" 

6. Run the reboot command.
reboot

7. Confirm the patches have been installed by running:
vmware -vl

Or, by looking at the version in the client:

8. Disable ESXi Shell/SSH

9.  Exit Maintenance mode and confirm functionality.


vCenter 6.5 upgrade: A problem occurred while - Starting VMware Postgres...

While migrating from a Windows vCenter 5.5 server to vCSA 6.5, I received the following errors while running the Migration Assistant:

A problem occurred while - Starting VMware Postgres...

and

This is an unrecoverable error, please retry install. 



This occurred during Stage 2 of the process.  The resulting vm-support.tgz file included a vcdb_import.err file which contained the following error:

NOTICE:  constraint "fk_vpx_lic_auto_keys_entity_id" of relation "vpx_lic_auto_keys" does not exist, skipping
NOTICE:  constraint "fk_vpx_lic_auto_keys_asset_id" of relation "vpx_lic_auto_keys" does not exist, skipping
NOTICE:  drop cascades to constraint fk_vpx_dbm_counter_values on table vpx_dbm_counter_value
NOTICE:  constraint "fk_vpx_dbm_counter_values" of relation "vpx_dbm_counter_value" does not exist, skipping
ERROR:  unquoted carriage return found in data
HINT:  Use quoted CSV field to represent carriage return.
CONTEXT:  COPY vpx_event_arg, line 374050

This is a known issue referenced in the following KB: 

With the help of our DBA, we reduced the tasks and events tables down to 30 days.  

The procedure to purge old data is located here: 

This resolved the issue and we were able to continue with the upgrade.

An alternative is to NOT migrate the Events and Task Data.  Unfortunately,  this will also exclude the performance metrics from being migrated:

Monday, March 27, 2017

VMware VirtualCenter Server Service Hung at Starting (No such host is known)

After a gracefully rebooting our vCenter server, the VMware Virtual Center Service was hung in the "Starting" status.  A quick look at Event Viewer showed the very common Event ID 1000:



On a Windows Server 2012 R2 box, the vCenter logs are located in the following location:

C:\ProgramData\VMware\VMware Virtual Center\Logs\vpxd.log

The log showed the following warnings:

2017-03-24T19:42:30.743-05:00 [04304 warning 'Default'] Failed to resolve address; <resolver p:0x000000000xxxxx, 'mypscserver.mydomain.com:7444'>, e: system:11001(No such host is known)

2017-03-24T19:42:30.743-05:00 [04304 error 'HttpConnectionPool-000001'] [ConnectComplete] Connect failed to <cs p:000000000af76900, TCP:mypscserver.mydomain.com::7444>; cnx: (null), error: class Vmacore::SystemException(No such host is known)

We are currently upgrading our vSphere infrastructure to version 6.5.  One of the first steps performed was to upgrade our external 5.5 SSO server to a 6.5 PSC appliance.  It appears the PSC appliance did not register properly in DNS.  No ping replies...

After adding a static entry in DNS and allowing time for the entry to propagate, I was able to successfully start the vCenter service.

I then performed a graceful restart of the vCenter server to make absolutely sure the vCenter server starts successfully.

vCenter Server 6.5 Upgrade: This vCenter Server has extensions registered that cannot be upgraded to or may not work with the new vCenter Server.

AKA:
How to unregister / remove a vCenter extension.

While running the vSphere 6.5 VMware Migration Assistant I received the following error:

This vCenter Server has extensions registered that cannot be upgraded to or may not work with the new vCenter Server. 

In my case, the extensions were no longer being used.  So, I chose to just remove the offending extensions.

1.  Create a snapshot or backup of your vCenter server.
2.  Log into the Managed Object Browser (MOB).

https://myvcenterserver.mycompany.com/mob

3. Select Content.

4. Select ExtensionManager.

5. Capture the VALUE of the Extension you wish to remove.  (ex.com.vmware.vcHms):

6. Select UnregisterExtension

7. Enter the Value of the extension you wish to remove.  Then, select Invoke Method.  Confirm that  you receive the Result of Void.

8. Confirm the extension is no longer in the extension list.  If so, delete the VM snapshot created earlier.


Common vCenter extensions:

Extension NameService Description
com.vmware.vim.eamvSphere ESX Agent Manager
com.vmware.vim.inventoryservicevCenter Inventory Service
com.vmware.vim.lsLicensing Services
com.vmware.vim.smsVMware vCenter Storage Monitoring Service
com.vmware.vim.spsVMware vSphere Profile-drive Storage Service
com.vmware.vim.stats.reportPerformance charts built-in extension
com.vmware.vim.stats.vsmService Manager
cim-uivCenter Hardware Status
health-uivCenter Service Status
hostdiagInternal extension to declare diagnostic events from VMware Host systems
VirtualCenterVirtualCenter dynamic events and tasks
com.vmware.orchestratorVMware vRealize Orchestrator plugin (formerly known as VMware vCenter Orchestrator plug-in)
com.vmware.rbdAuto Deploy
com.vmware.syslogVMware Syslog Collector Configuration
com.vmware.vcDrVMware vCenter Site Recovery Manager Extension
com.vmware.vcHmsvSphere Replication Management (VRM)
com.vmware.vcIntegrityVMware vSphere Update Manager Extension
com.vmware.vShieldManagervShield Manager
vCloud Director-1vCloud Director
com.vmware.vcopsvRealize Operations Manager (formerly known as vCenter Operations Manager)
com.vmware.vadmVMware vRealize Infrastructure Navigator (formerly known as vCenterInfrastructure Navigator)
com.vmware.vdpvSphere Data Protection 5.1
com.vmware.vdp2
com.vmware.vdp2.config
vSphere Data Protection 5.5/5.8
com.vmware.vsan.healthvSAN Health Check Plug-in
com.vmware.heartbeattasksvCenter Server Heartbeat
com.vmware.hbwcvCenter Server Heartbeat
com.vmware.heartbeatvCenter Server Heartbeat
com.neverfail.heartbeatvCenter Server Heartbeat