ESX disconnected from vCenter

One of my esx 5.5 u3 hosts was disconnected from vCenter. The VMs were still running but reconnecting it to vCenter would result in an vmodl.fault.HostCommunication error.

vmodl-fault-hostcomm.png

I logged into the console and looked at the logs and saw that the ramdisk /tmp was full. I verified that it was full with esxcli system visorfs ramdisk list [1]

A simple ls -al /tmp showed that an error log file was filling up the entire ramdisk. I deleted the file and the host automatically reconnected to vCenter.
del_log_file.png

Advertisements

Device busy during write memory

kind of a scary bug encountered today on a router. I tried to save a config and received a “device busy” error. The issue was a stuck vty connection. After clearing it (clear line vty X) I could wr mem successfully.

https://supportforums.cisco.com/t5/lan-switching-and-routing/4500x-problem-cannot-write-memory-startup-config-file-open/td-p/2603864

 

Reclaiming space on VMs

Here are some great posts about reclaiming unused space in esxi.

WHAT’S NEW IN ESXI 6.5 STORAGE PART I: UNMAP

IN-GUEST UNMAP FIX IN ESXI 6.5 PART I: WINDOWS

IN-GUEST UNMAP, ENABLEBLOCKDELETE AND VMFS-6

To get automatic space reclamation you’ll need:

  • ESXi 6.5 Update 1
  • iSCSI volume formatted with VMFS6. (I think VMFS5 works but there are caveats.)
  • Thin provisioned disks.
  • discard option enabled on mount points for your Linux guests.

My new esxi 6.5 host connecting to iscsi volume on FreeNAS 11.0 works like a charm at least when I force and UNMAP with sudo fstrim /

I haven’t had it enabled long enough to watch it work it’s magic, but apparently this means no more filling the drive with zeros, then punching a hole while the machine is offline.

UPDATE 2018-01-20: The magic happens immediately. You can see the updated datastore size immediately after deleting a large file in a linux VM.

It also means that as much as I hate setting up iSCSI, I’m not going to go back to NFS if it doesn’t have this.

Convert VMDK to Thin without vMotion

Storage vMotion is wonderful but vMotion isn’t available without vCenter. bah!

This was a nice guide:

  1. Enable SSH to the host.
  2. Browse to the VM
    cd /vmfs/volumes/<datastore>/<vm>
  3. Create a thin version of the VM.
    vmkfstools -i d <vharddrive>.vmdk -d thin <vharddrive>-thin.vmdk
  4. Remove the thick .vmdk
  5. Attach the thin .vmdk
  6. Delete the old .vmdk and *-flat.vmdk

 

Windows Spotlight Wallpaper

Windows Spotlight has some nice wallpaper and I’d like to keep a couple for later use, so here’s the shortest Powershell script I could make to save them to my Pictures directory:

$src = "$env:LOCALAPPDATA\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"

$dest = "$env:USERPROFILE\Pictures\Windows Spotlight"

Get-ChildItem "$src" | where {$_.length -gt "141160"} | foreach {cp "$src\$_" "$dest\$_.jpg"}

I only copy files greater than 141160 bytes because some files in that directory are not wallpapers and the largest non-wallpaper file is 141160 bytes. So it’s a good starting point.

If user exists?

Getting a simple script to check if an AD user exists has been a nightmare. I wanted something simple and straightforward and I finally found it.

$userobj = $(try {Get-ADUser $user} catch {$null})
if ($userobj -ne $null) {
   Write-Host "$user already exists" -foregroundcolor Green
} else {
   Write-Host "$user not found " -foregroundcolor Red
}

Another options would be to use dsquery:

if (dsquery user -samid $user) {
   Write-Host"$($user.name) exists."
} else {
   Write-Host"$($user.name) doesn't exist."
}

These are the simplest options I can find.

Powershell and SNMP

I’ve been trying to get all my servers snmp settings fixed and it’s been kind of a pain. Powershell doesn’t have any good cmdlets, but I’ve found a couple examples. This is very nice script, but doesn’t work on remote machines unless you do PS Remoting. (I need to bone up on my PS remoting now.)

I ended up using the following for the base of a script. I need only a very simple script so this looks for a specific registry key which will be the name of the CommunityString. Since mine is ‘Public’, I’m just looking for that.

function Get-RemoteRegistryValue ([string]$ComputerName, [string]$KeyPath, [string]$Value) {
    try {
        $Hive = [Microsoft.Win32.RegistryHive]::LocalMachine
        $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey($Hive, $ComputerName)
        $key = $reg.OpenSubKey($KeyPath)
    } catch {
        return "ERR"
    }
    return $key.GetValue($Value)
}
Get-RemoteRegistryValue -ComputerName $server -KeyPath 'SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities' -Value 'Public'

Intel AC-7260 and UniFi

An Intel AC-7260 (on my Latitude 7440) was stuck at 54Mbps when connecting to my Ubiquiti AP AC-Lite. It’s been a great AP to me and all my other devices connect right up, so the issue must be with the laptop or wifi adapter. I found that the laptop wouldn’t connect at all if I set WPA2 to use AES only which is recommended because TKIP is deprecated.

wpa2_auto.PNG
I don’t like reduced performance.

When transferring large files I’d only get 3.5MBps. Ohfercryinoutloud, a cheap flash drive does better than that!

After messing with settings and drivers for a while, I finally found what was needed to get the AC-7260 to connect to WPA2 with AES/CCMP.

Using the latest Intel drivers (v19.70)

  1. Right Click / Status on the wifi adapter while connected to the SSID.
  2. Click Wireless Properties.
  3. Go to the Security tab and change the Encryption Type to AES.
  4. Set AP to use WPA2 with AES/CCMP.

    wifi_status.PNG
    Forcing it to use AES for this SSID.

Next, just make sure you’re on a A band for best performance by either using the Connection tab next to the Security tab or by using the Preferred Band setting in the Advanced tab of the driver.

xfer_increase.png
The changes made a difference.

WSUS: Reset Server Node While Browsing Computers

I’ve run into another very annoying WSUS bug and this one deals with Computer Model information being corrupted when being entered into the SUS DB.

wsus_groups.png
Crashing groups highlighted in red.

Twice I’ve encountered a bug where the WSUS console would crash every time I tried to browse the All Computers or Unassigned Computers groups, but it wouldn’t crash when I browse another sub-group.

I found a very useful blog post that showed how to fix it but I’m unable to find it now; however, I was able to remember the steps I took.

  1. Using SSMS, export the table tbComputerTargetDetail to a csv. (Select * query, then save the results as csv.)
  2. Sort the various columns to find the one with the box (like an unknown character). This is the corrupt entry. For me, its always been the ComputerModel field.

    wsus_corrupt_example.png
    A similar example.
  3. Note the TargetID #.
  4. You can use the TargetID number in the tbComputerTarget table to find out the hostname of the offending machine for a permanent fix.*
    SELECT FullDomainName
    FROM [SUSDB].[dbo].[tbComputerTarget]
    WHERE TargetID = '<targetid#>'
  5. Blank out this field.
    UPDATE [SUSDB].[dbo].[tbComputerTargetDetail]
    SET ComputerModel=''
    FROM [SUSDB].[dbo].[tbComputerTargetDetail]
    WHERE TargetID='<targetid#>'

WSUS will be working again.

*To fix this issue on my client machines, I’ve only needed to update the offending machine’s BIOS.