{{ :supportukraine.gif|}}
====== 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 =====
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 '''' stand for the latest release number of the current development which can be checked [[https://github.com/PowerShell/PowerShell/releases/ | here]].
$ wget https://github.com/PowerShell/PowerShell/releases/download/v../powershell-..-linux-arm32.tar.gz
$ mkdir //powerShellCore
$ tar -xvf ./powershell-..-linux-arm32.tar.gz -C //powerShellCore
Start //PowerShell Core// ...
$ //powerShellCore/pwsh
...and check currently installed //PowerShell Core// version:
$PSVersionTable.PSVersion
Now install //PowerCLI//:
Install-Module -Name VMware.PowerCLI -Scope CurrentUser
Check currently installed //PowerCLI// version:
Get-PowerCLIVersion
Optional: Disable warning messages:
Set-PowerCLIConfiguration -Scope User -ParticipateInCEIP $false
Optional: Disable certificate checks:
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore
Quit //PowerShell Core//:
exit
Optional: Make //PowerShell Core// available globally:
$ //pwsh -c New-Item -ItemType SymbolicLink -Path "/usr/bin/pwsh" -Target "\$PSHOME/pwsh" -Force
$ apt-get upgrade powershell
Connect to desired host (//ESXi//-Host or //vCenter-Appliance//) via //PowerCLI//:
\\
\\
Connect-VIserver -Server -User -Password
Via //PowerCLI//:
\\
\\
Get-VMHostFirmware -VMHost -BackupConfiguration -DestinationPath //
For automation purposes scripts can be used.
\\ The following example shows script creation for automated power-on of //VM//s on a //vSphere// host.
\\ \\ Create a script folder via //Bash// command line:
\\
\\
$ mkdir //
Then:
$ touch ///.sh
$ touch ///.ps
$ vi ///.sh
Add the following content:
//pwsh ///.ps
Save the file and quit the editor.
$ vi ///.sh
Add the following content (In the following script choose //VM// names __exactly__ the same way the //VM//s 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 -User -Password
Start-VM
start-sleep -s 30
Start-VM
Start-VM
Start-VM
Exit
Save the file and quit the editor.
$ chmod +x ///.sh
$ chmod +x ///.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.)!
Start //PowerShell Core//...
\\
\\
$ //powerShellCore/pwsh
...then update //PowerCLI//:
Update-Module VMware.PowerCLI
Quit //PowerShell Core//:
exit
Clear history:
\\
\\
Remove-Item (Get-PSReadlineOption).HistorySavePath
For //PowerShell// cache clearing it is necessary to quit //PowerShell Core// now:
exit
\\
===== End of tutorial =====
\\
\\
Appreciate my work? \\ [[https://www.buymeacoffee.com/fabioU|Buy me a coffee]] {{:buymeacoffee.png|}} or [[https://www.paypal.com/donate/?hosted_button_id=TH8Q3NTJCAJBA|PayPal]] {{:paypal.png|}}
\\
\\
**Source(s):**
\\
[[https://blog.uprightvinyl.co.uk/2018/03/07/installing-vmware-powercli-10-on-a-raspberry-pi/|Installing VMware PowerCLI 10 on a Raspberry Pi]]
\\
[[https://blogs.vmware.com/PowerCLI/2018/02/powercli-10.html|VMware PowerCLI Blog]]
\\
[[https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-6|Installing PowerShell Core on Linux]]
**Additional //PowerCLI// commands for //vSphere// control:**
\\ [[https://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/index.html|PowerCLI Cmdlets]]
{{htmlmetatags>metatag-robots=()}}