User Tools

Site Tools


VMware vSphere: Controlling via Raspberry Pi

First thoughts

In many cases VMware vSphere controlled over Raspberry Pi can be a userful solution. Some possible usages are shown in the following tutorials.


For PowerShell Core installation on a Raspberry Pi at least a Raspberry Pi 2 is required!

Start of tutorial

PowerShell Core and PowerCLI


Login via SSH with User pi into Raspberry Pi.

Install PowerShell Core and additional required tools:

$ apt-get install libunwind8
$ cd /tmp

Note: The following placeholders <x> stand for the latest release number of the current development which can be checked here.

$ wget<x>.<x>.<x>/powershell-<x>.<x>.<x>-linux-arm32.tar.gz
$ mkdir /<myPath>/powerShellCore
$ tar -xvf ./powershell-<x>.<x>.<x>-linux-arm32.tar.gz -C /<myPath>/powerShellCore

Start PowerShell Core

$ /<myPath>/powerShellCore/pwsh

…and check currently installed PowerShell Core version:


Now install PowerCLI:

Install-Module -Name VMware.PowerCLI -Scope CurrentUser

Check currently installed PowerCLI version:


Optional: Disable warning messages:

Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false

Optional: Disable certificate checks:

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

Quit PowerShell Core:


Optional: Make PowerShell Core available globally:

$ /<myPath>/pwsh -c New-Item -ItemType SymbolicLink -Path "/usr/bin/pwsh" -Target "\$PSHOME/pwsh" -Force

Update PowerShell Core to the latest release version

$ apt-get upgrade powershell

Connect to a vSphere host

Connect to desired host (ESXi-Host or vCenter-Appliance) via PowerCLI:

Connect-VIserver -Server <myTargetHostIPaddress> -User <myUser> -Password <myUserPassword>

Save current ESXi configuration into a file

Via PowerCLI:

Get-VMHostFirmware -VMHost <myTargetIPaddress> -BackupConfiguration -DestinationPath /<myPath>/

Automation via scripts

For automation purposes scripts can be used.
The following example shows script creation for automated power-on of VMs on a vSphere host.

Create a script folder via Bash command line:

$ mkdir /<myPath>/<myScriptFolder>


$ touch /<myPath>/<myScriptFolder>/<myBashScriptFile>.sh
$ touch /<myPath>/<myScriptFolder>/<myPowerCLIscriptFile>.ps
$ vi /<myPath>/<myScriptFolder>/<myBashScriptFile>.sh

Add the following content:

/<myPowerShellCorePath>/pwsh /<myPath>/<myScriptFolder>/<myPowerCLIscriptFile>.ps

Save the file and quit the editor.

$ vi /<myPath>/<myScriptFolder>/<myPowerCLIscriptFile>.sh

Add the following content (In the following script choose VM names exactly the same way the VMs are named on ESXi host) (Note: The start-sleep command can be used optionally for delayed power-on, for example when there is a domain controller which generally always should get available at first inside a network environment):

Connect-VIServer -Server <myTargetHostIPaddress> -User <myUser> -Password <myUserPassword>
Start-VM <myFirstVM>
start-sleep -s 30
Start-VM <mySecondVM>
Start-VM <myThirdVM>
Start-VM <myFourthVM>

Save the file and quit the editor.

$ chmod +x /<myPath>/<myScriptFolder>/<myBashScriptFile>.sh
$ chmod +x /<myPath>/<myScriptFolder>/<myPowerCLIscriptFile>.ps

Beware: Due to certificate verification and therefore for successful scripting it is required to connect manually once when connecting for the very first time between client und server via remote SSH. (Alternatively: Do a certificate import.)!

Update to latest PowerCLI version

Start PowerShell Core

$ /<myPath>/powerShellCore/pwsh

…then update PowerCLI:

Update-Module VMware.PowerCLI

Quit PowerShell Core:


Clear PowerShell Core history

Clear history:

Remove-Item (Get-PSReadlineOption).HistorySavePath

For PowerShell cache clearing it is necessary to quit PowerShell Core now:


End of tutorial

vmwarevsphereraspipi.txt · Last modified: 2020/11/03