This isn’t really documented anywhere on the VMware website, but it comes in really handy if require certain users to have console access to machines without the complication of the vSphere Web Client.

  • Install VMware Player from the VMware website

  • Get the Managed Object ID of the VM. This can be done through PowerCLI with the following script:

1
2
3
4
5
6
7
8
9
$vcenter = "vcenter.domain.name"
$targetvm = "targetvm"
Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer -Server $vcenter -Force
$vmid = (Get-VM $targetvm).id -replace "VirtualMachine-",""
Disconnect-VIServer -Server $vcenter -Confirm:$false
Write-Output "VM MOID is $vmid"
  • Give the user access to the VM. The permission “Virtual Machine\Interaction\Console Interation” needs to be given on both the VM and the host. It doesn’t need to inherit to children so deselect “Propagate to children” in the permisisons screen”.

  • Create a shortcut to connect straight to the VM. The following PowerShell script can create the shortcut automatically.

1
2
3
4
5
6
7
8
9
$desktop = [Environment]::GetFolderPath("Desktop")
$vcenter = "vcenter.domain.name"
$targetvm = "targetvm"
$vmid = "vm-moid"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$desktop\$targetvm.lnk")
$Shortcut.TargetPath = "vmrc://$vcenter/?moid=$vmid"
$Shortcut.Save()

Afterwards, double click on the shortcut on the desktop and enter appropriate credentials. You’ll be straight in to the console.

Comment and share

The following script generates a report of all datastores and their multipathing policy. This was extremely useful when fixing up some datastores to use best practices with our 3PAR systems.

Run with:

.\multipathing.ps1 -vCenter vcenter.domain.com -VMHost esxi.domain.com

Comment and share

A hosts management network interface somehow dropped off the network this afternoon. Fortunately I was still able to get in through iLO. It always pays to have an out-of-band interface active!

esxi-no-mgmt.png

From the DCUI screen, press Alt + F1. This will bring up the login screen. Log in as root then type esxcli network ip interface list. You will get an output similar to the one below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
vmk2
Name: vmk2
MAC Address: 00:50:56:79:0c:de
Enabled: true
Portset: DvsPortset-0
Portgroup: N/A
VDS Name: dvSwitch-vMotion
VDS UUID: 0c 7d 1a 50 93 7b 86 3f-76 f8 74 80 73 7c 3d 0f
VDS Port: 101
VDS Connection: 1952632411
MTU: 1500
TSO MSS: 65535
Port ID: 33554436
vmk0
Name: vmk0
MAC Address: 00:1c:c4:bd:d6:ee
Enabled: false
Portset: DvsPortset-2
Portgroup: N/A
VDS Name: dvSwitch
VDS UUID: 10 e1 1a 50 b1 22 19 a1-d4 33 10 dc 72 9a 92 db
VDS Port: 151
VDS Connection: 660732515
MTU: 1500
TSO MSS: 65535
Port ID: 67108871

Fortunately mine was an easy issue to solve; vmk0 had Enabled: false. An easy fix: esxcli network ip interface set -i vmk0 -e true

After this I was able to reconnect to the host from within vCenter.

Comment and share

Backups in my work environment are done on the folder level through Veeam (excellent product), and sometimes virtual machines are moved around and get loosed from backups without us noticing. This little script monitors the folder and alerts on any changes when combined with Task Scheduler.

A few things:

  • Make sure the account you run it under can send email
  • Make sure the account has vSphere read permissions

Enjoy.

Comment and share

  • page 1 of 1

Jacob Ludriks

author.bio


author.job