VMware provides PowerCLI which is a set of modules for VMware vSphere. Now I bring to you old news.... you should know that PowerShell is a powerful scripting language.... Initially, PowerShell enabled to manage only Windows Workstation or Server, but since sometimes, a lot of vendors make their own modules to manage their solutions (such as Veeam, VMware and so on....). PowerShell is available on Linux as well.
Install or update PowerCLI
Very simple instalation... just install the module and go:
To install PowerCli from the PowerShell gallery you need Internet Access. Then run:
Install-Module -Name VMware.PowerCLI
If you have already installed PowerCLI from the PowerShell gallery, you can run the following command:
Update-Module -Name VMware.PowerCLI
When PowerCLI is instalation is over, you can run: You can see that 922 cmdlet exists for VMware vSphere. That’s a lot!
Get-Command -module *VMware* | measure
Attention:
You need PowerShell v5 at least. If you are not using Windows 10 or Windows Server 2016, you can install the latest Windows Management Framework.
You need PowerShell v5 at least. If you are not using Windows 10 or Windows Server 2016, you can install the latest Windows Management Framework.
Connect to VMware vCenter
To manage VMware vSphere you have to connect to VMware vCenter. First, run a Get-Credential to store in variable credentials to connect to vCenter. Then run the following command:
Connect-VIServer -Server <vCenter FQDN> -Credential <Credential variable>
$admin_credential = Get-Credential
Connect-VIServer -Server your_server.you-domain.com -Credential $admin_credential
Also you can run for example:
Get-VM |ft Name, Guest, VMHost, PowerState
Of course you can combine versatilitie of powershell with 911 cmdlet exists for VMware vSphere to do a lot of things....
:-)
Nenhum comentário:
Postar um comentário