Monday, February 20, 2017

vCenter VM operations error: The operation is not allowed in current state

Today while trying to take snapshot of one the VM, end up with following error,

“The operation is not allowed in current state”

Then I tried to vMotion the VM to any other host but no luck, same was true for any other task however I didn’t see any issue with other VMs on this host.


I also checked for any associated running task but couldn't find any.

I had seen such errors earlier and most of the time such error occur because either the ESXi host or a virtual machine is in an unexpected state and to work around this, we just need to restart the host management agents.

Note: Before restarting the host management agents, make sure no Virtual machine is configured to poweron/off with host otherwise it may reboot.

To restart the VMware host management agent, connect to host over ssh using putty and run following commands,

/etc/init.d/hostd restart

/etc/init.d/vpxa restart

Reference: Related VMware kb# 1003829

That’s it… J


Thursday, February 9, 2017

VMware vExpert 2017 Announced

VMware just announced the vExpert 2017…. I am very honored to be named a VMware vExpert again…..Congrats to all those who named as a 


Here is the full list of vExpert 2017... https://blogs.vmware.com/vmtn/2017/02/vexpert-2017-award-announcement.html 

That's it... :)


Monday, February 6, 2017

vimtop: To Monitor the performance and Resource Usage of services on vCenter Server Appliance

Vimtop is a tool similar to esxtop, which runs in the environment of the vCenter Server Appliance. By using the text-based interface of vimtop in the appliance shell, we can view the performance information and statistics about VCSA and the applications running under it and a list of vSphere services and their resource usage.

If you have ever used esxtop before with ESXi, then you would have a similar experience here. This will definitely be a handy a tool to be aware of when needing to troubleshoot performance issues or bottlenecks in the VCSA as useong vimtop we can monitor vCenter services in real time.

To launch vimtop, we first need access Appliance direct console or SSH to a VCSA 6.x system and type "vimtop" in either the appliance shell or in a regular bash shell.

To access the appliance shell, press ALT+F1 when you are accessing Appliance console (same like accessing DUCI of ESXi).

As you can see, when it launches, shows combination of cpu and memory related information and also the processes running on the appliance with resources used. Notice at the top we see the uptime, load averages, cpu breakdown, memory and swap related information.

As highlighted in last image, on this screen we can access Help by pressing H, Disk related info using K, Network info using O, Pause and refresh by pressing P and R keys etc.

When running in interactive mode, vimtop recognizes several other single-key command

All interactive mode panels recognize the commands listed on this page.
For detailed info about vimtop usage, please have a look at vimtop related topics in VMware Documentation Here.

That's it... :)


Friday, February 3, 2017

PowerCLI script to get list of Snapshots older then x days as a mail atachment

This script would sent you a list of Snapshots older than x days(replace x with the the number of days as required) in html table format as a mail attachment.

To run this script, copy the content of it to notepad file and save it as file_name.ps1 now you can run it from any system which have Windows Powershell and VMware PowerCLI installed.

<# ==================================================================
Title: Get_Snapshot_list.ps1
Description: List Snapshots older than x days and then email it as an attachment
Requirements: Windows Powershell with PowerCLI installed
Usage: .\Get_Snapshot_list.ps1
==================================================================== #>
Add-PSSnapin VMware.VimAutomation.Core

$viserver = Connect-VIServer vCenter_Server_Name_or_IP -user "userName" -password "your vCenter Password"

$SnapshotReport = Get-VM  | Get-Snapshot | where { $_.Created -lt (Get-Date).AddDays(-15)} | select VM, Name, Powerstate, SizeMB, Created | ConvertTo-Html | Set-Content SnapshotReport.html

$EmailFrom = "from_mail_id"

$EmailTo = "to_mail_id"

$subject = "Snapshots older then x days"

$body = "Please find the enclosed snpshot report: SnapshotReport.html"

$smtp = "smtp_server_address"

$viserver; $SnapshotReport; Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $subject -Body $body -SmtpServer $SMTP -Attachments "snapshotreport.html" -Priority "High"

Remove-Item SnapshotReport.html

Disconnect-VIServer "vCenter_server_name_or_IP" -Confirm:$false
By scheduling this script using task scheduler we can get the snapshot report on weekly basis. To schedule this script, please check the following post, How to run Powershell script as a scheduled task.

As here the login credentials are written in plain text so if are planing to schedule this script then instead of using login credentials in script, it would be better to schedule it using credentials which already have login rights on vCenter and as PowerShell supports passthrough authentication so that will also work.

That's it... :)