PowerVCF: A PowerShell Module for VMware Cloud Foundation
PowerVCF
is an open source PowerShell Module for interacting with the VMware Cloud Foundation (SDDC Manager & Cloud Builder) public API.
Module
VMware Cloud Foundation
Requirements
Platform
-
VMware Cloud Foundation 4.0 or later.
The module supports versions in accordance with the VMware Product Lifecycle Matrix from General Availability to End of General Support.
Learn more: VMware Product Lifecycle Matrix
Note
This version has been tested using vSAN Ready Nodes.
VMware Cloud Foundation on VxRail has not been fully tested. The following cmdlets will not work with VxRail as the workflow is different due to the use of VxRail Manager.
New-VCFCommissionedHost
Remove-VCFCommissionedHost
- All Network pool actions
New-
,Set-
, andRemove-
for Workload Domains
Other cmdlets may work but are subject to testing.
PowerShell
- Microsoft Windows PowerShell 5.x
- Microsoft PowerShell Core 6.x and 7.x
PowerShell Modules
VMware PowerCLI
12.3.0 or later
Installing the Module
Verify that your system has a supported edition and version of PowerShell installed.
From the PowerShell Gallery
Install the module from the PowerShell Gallery by opening a PowerShell session as an Administrator and running the following command:
Install-Module -Name PowerVCF
From Source
Install the module from the from source first downloading and extracting the release archive. Next, open a PowerShell session as an Administrator, navigate to the directory where the binary has been extracted, and run the following command:
Import-Module .\PowerVCF
Getting Started
All API operations must currently be authenticated using the SDDC Manager. To create a base64
credential to authenticate each cmdlet you must first run the Request-VCFToken
cmdlet.
This example shows how to connect to SDDC Manager to request API access & refresh tokens using the default [email protected]
vCenter Single Sign-On administrator account.
Request-VCFToken -fqdn sfo-vcf01.sfo.rainpole.io -username administrator@vsphere.local -password VMw@re1!
This example shows how to connect to SDDC Manager using the admin@local
local administrator account.
Request-VCFToken -fqdn sfo-vcf01.sfo.rainpole.io -username admin@local -password VMw@re1!VMw@re1!
Note
Both
-username
and-password
are optional parameters. If not passed, a credential window will be presented.
Authentication is only valid for the duration of the PowerShell session.
Examples
Get a List of Hosts
Get-VCFHost
Sample Output:
id : 598519e7-cbba-4a10-801d-d76111f3ce0e
esxiVersion : 7.0.2-17867351
fqdn : sfo01-m01-esx01.sfo.rainpole.io
hardwareVendor : Dell Inc.
hardwareModel : PowerEdge R630
ipAddresses : {@{ipAddress=172.28.211.101; type=MANAGEMENT}, @{ipAddress=172.28.213.101; type=VSAN},
@{ipAddress=172.28.212.101; type=VMOTION}}
cpu : @{frequencyMHz=55999.953125; usedFrequencyMHz=11209.0; cores=28; cpuCores=System.Object[]}
memory : @{totalCapacityMB=262050.28125; usedCapacityMB=59413.0}
storage : @{totalCapacityMB=7325664.0; usedCapacityMB=297924.625; disks=System.Object[]}
physicalNics : {@{deviceName=vmnic0; macAddress=24:6e:96:56:10:50}, @{deviceName=vmnic1; macAddress=24:6e:96:56:10:52},
@{deviceName=vmnic2; macAddress=24:6e:96:56:10:54}, @{deviceName=vmnic3; macAddress=24:6e:96:56:10:55}}
domain : @{id=51cc2d90-13b9-4b62-b443-c1d7c3be0c23}
networkpool : @{id=0e06eff5-9fe7-4299-940b-5c8beb3f3ac0; name=sfo-m01-np01}
cluster : @{id=cc747835-79bc-4900-8703-f5ef1fa87990}
status : ASSIGNED
bundleRepoDatastore : lcm-bundle-repo
hybrid : False
You can also filter the output of the cmdlet.
Example 1:
Get-VCFHost -id 598519e7-cbba-4a10-801d-d76111f3ce0e | Select esxiVersion
esxiVersion
-----------
7.0.2-17867351
Example 2:
$hostDetail = Get-VCFHost -id 598519e7-cbba-4a10-801d-d76111f3ce0e
$hostDetail.esxiVersion
7.0.2-17867351
Get Help
Once installed, any cmdlets associated with PowerVCF
will be available for use.
To view the cmdlets for available in the module, run the following command in the PowerShell console.
Get-Command -Module PowerVCF
To view the help for any cmdlet, run the Get-Help
command in the PowerShell console.
For example:
Get-Help -Name <cmdlet name>
Each cmdlet support the following options:
Get-Help -Name <cmdlet name> -Examples
Get-Help -Name <cmdlet name> -Detailed
Get-Help -Name <cmdlet name> -Full
Contributing
The project team welcomes contributions from the community. Before you start working with PowerValidatedSolutions, please read our Developer Certificate of Origin. All contributions to this repository must be signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on as an open-source patch.
For more detailed information, refer to the contribution guidelines to get started.
Disclaimer
This PowerShell module is not supported by VMware Support.
If you discover a bug or would like to suggest an enhancement, please open an issue.
License
Copyright 2021-2022 VMware, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.