Visitors

VMware PowerCLI and ESXi Shell scripts

Small collection of VMware PowerCLI / Powershell scripts and onliners to save time re-typing them:

Get a list of all virtual machines with snapshots and save it to a csv file; # Get-VM | Get-Snapshot | Select-Object VM, Name, SizeMB, Created, Description | Export-Csv c:snapshots.csv # Get a list of virtual machines, guest IP address, […]

HOW TO: Start, Stop, Restart services on VMware vSphere ESX server via PowerCLI

The service you will need to start or stop simultaneously on multiple servers is likely to be the SSH (TSM-SSH) service.

Here is how you do it with PowerShell / PowerCLI:

$vCenter = ‘vCenter.vstrong.info’ ; Name or IP address of your vCenter Server $Cluster = ‘Vblock cluster 1’; Name of the cluster Connect-VIServer $vCenter $Scope […]

HOW TO: Find HBA WWN number on VMware vSphere ESX server

There are several ways to get HBA WWNs on VMware vSphere ESX/ESXi host:

vSphere Client; Using ESXi Shell; Using Powershell / PowerCLI script.

1. Connect to a server or vCenter, open server Configuration tab, under Hardware select Storage Adapters:

You can also copy WWNN (World Wide Node Name) and WWPN (World Wide Port […]

Trend Micro Deep Security: Anti-Malware Engine Offline

In my ongoing battle with Trend Micro Deep Security I came across another problem / strange behavior. Virtual machines running on a particular host had Anti-Malware Engine Offline status.

DSVA was Managed (Online) and did not present any other issues. Going through the usual sequence <Clear Warnings/Errors> – <Check Status> did not clear the […]

HOW TO: Enable or Disable Lockdown Mode on VMware vSphere ESXi host

Q: What is Lockdown Mode? A: Lockdown Mode prevents users from logging directly to the host. The host will only be accessible through local console or vCenter Server. None of remote management options e.g. vCLI, PowerCLI script, SSH will work. When it is enabled, only vpxuser () has authentication permissions and can connect to the […]

HOW TO: Create a new user and add it to a role on ESXi host.

This script creates a new user and adds the user to a role on the ESX host:

$NewUser = ‘_New_user_name_’ $NewUserPassword = ‘_New_user_Password_’ $NewUserDesc = ‘_New_user_description_’ $HOSTCredentials = Get-Credential -Credential root $ESXhost = ‘_My_ESX_HOST_’ Connect-VIServer $ESXhost -Credential $HOSTCredentials New-VMHostAccount -Id $NewUser -Password $NewUserPassword -Description $NewUserDesc -UserAccount -Server $ESXhost -AssignGroups users $AuthMgr = Get-View (Get-View ServiceInstance).Content.AuthorizationManager […]