Enable SSH cluster-wide with PowerCLI

This article shows how to quickly enable SSH service on one, more or all hosts in a cluster.

Start service

Login to vCenter.

Connect-VIServer <myVC>

The command below will activate SSH on all hosts registered in in your vCenter.

Get-VMHost | Get-VMHostService | Where Key -EQ "TSM-SSH" | Start-VMHostService

TSM means “Technical Support Mode”

Stop SSH service

To stop SSH service on all hosts, use the command below.

Get-VMHost | Get-VMHostService | Where Key -EQ "TSM-SSH" |  Stop-VMHostService -Confirm:$False

Selective activation

It’s possible to limit the scope of the command to one host. Just add the FQDN after Get-Host.

Get-VMHost myESX.myDomain.local | Get-VMHostService | Where Key -EQ "TSM-SSH" | Start-VMHostService

Find VMs without tags

Check Backup-Tag SLA

VMware tags are a versatile tool to dynamically assign VMs to groups. One use-case is leveraging VM-Tags to guarantee backup-SLA. Im my case there’s a category named “Backup” which contains several backup SLA tags for weekly or daily backups.


With PowerCLI you can find out quickly which VMs have no tags.

connect-viserver myVC
get-vm | ?{ (get-tagassignment $_) -eq $null}

This query isn’t sufficient yet. It’ll report only VMs that have no tags at all. But we’d like to find VMs that have no tags from the category “Backup”. So we have to modify our query a little bit.

get-vm | ?{ (get-tagassignment $_ -category Backup) -eq $null}

You need to adjust your query with the corresponding category name.


Backup and Restore of ESXi host configurations with PowerCLI

I’m a big fan of PowerCLI one-liners. 🙂

Before performing updates, upgrades or any other maintenance on ESXi hosts, you should backup your ESXi host configuration. Setting up a new ESXi host as replacement is a no-brainer, but rebuilding a lost configuration can be a PITA and might take hours.

In the old times it was necesary to open a SSH shell connection or to use vSphereCLI to issue backup commands to ESXi hosts. Recently I realized that there is a very handy PowerShell commandlet to backup and restore the configuration. Continue reading “Backup and Restore of ESXi host configurations with PowerCLI”

Using VM tags to manage backup SLAs

Agile backup job assignment with VM-tags and Veeam Backup

Organizing VMs in backup jobs can be a tedious task. Especially when there is a larger number of VMs and multiple jobs. It might happen that you miss out a VM for a job, or have it doubled.

To check whether a VM is backed up by the corresponding jobs, you either have to go through the settings of every single job or use smart tools like Veeam-One.

There are a couple of ways to add VMs to a backup job. You can choose single VMs by name, or select an entire VM folder, resource-pool or datastore. But one of the most sophisticated and versatile methods is to leverage VM-tags for selection.

What are tags?

A tag behaves like a label or a sticker that you put on a VM. It defines a property or a membership of a given VM. Think of a tag that marks a VM for daily backup. A second tag might mark a VM for hourly or weekly backup. You don’t have to adjust your backup jobs twice a week to remove or add new virtual machines. With VM-tags you don’t have to touch backup jobs at all. Just tell the job once to select all VMs with a specific tag and you’re done.

Even checking job membership for a VM is easier with tags. Just have a look at its tags.


I will now show a simple example how to use tagged VMs in combination with Veeam Backup & Replication.

Continue reading “Using VM tags to manage backup SLAs”