Get-OvfConfiguration on steroids

Generate a PowerCli function from ANY OVF/OVA package to ease the creation of an ovfconfiguration object to be used with Import-VApp.


The audience for this script is anyone interested to deploy a VMware appliance via PowerCLI.
This script is based on Get-OvfConfiguration and will generate, for any ovf/ova package, a PowerCli friendly function designed to create an OvfConfiguration specifically for this package.

The Get-OvfConfiguration is the foundation for everything mentioned in this post so please be sure to be familiar with it before reading further.
There is an excellent introduction for this topic in this post written by Brian Graf.
PowerCLI 5.8 New Feature: Get-OvfConfiguration (Part 1 of 2)

Function generated for “VMware-vRealize-Log-Insight-2.5.0-2347850.ova”
Let’s start by showing what kind of function can be generated and then more details will be provided regarding how it has been done.

function New-OvfConfiguration_VMware-vRealize-Log-Insight-2.5.0-2347850{
<#
.SYNOPSIS
This PowerCLI cmdlet create a PowerCli object OvfConfiguration specifically designed to be used when importing the VMware-vRealize-Log-Insight-2.5.0-2347850 ovf/ova package with the Import-VApp cmdlet.
It relies on the get-ovfconfiguration PowerCli cmdlet

.DESCRIPTION
This function is based on the original get-ovfconfiguration PowerCLI cmdlet...
...and convert it in a Powershell friendly function specifically for the package VMware-vRealize-Log-Insight-2.5.0-2347850
It is mandatory to be connected to one vCenter or Get-OvfConfiguration will throw an error

.NOTES
Author: Christophe Calvet
Blog: http://www.thecrazyconsultant.com/Get-OvfConfiguration_on_steroids

.LINK
This function has been generated by script for a VMware-vRealize-Log-Insight-2.5.0-2347850 ovf/ova package.
The script used to create this function is available at the link below, and can be used for any ovf/ova packages.
Get-OvfConfiguration on steroids
Documentation for the original get-ovfconfiguration http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.powercli.cmdletref.doc/Get-OvfConfiguration.html Link for a good overview of get-ovfconfiguration http://blogs.vmware.com/PowerCLI/2014/09/powercli-5-8-new-feature-get-ovfconfiguration-part-1-2.html .PARAMETER DeploymentOption OvfTypeDescription: string["xsmall", "small", "medium", "large"] Extra Small IMPORTANT: This configuration is intended for proof-of-concept or test environments and should not be used in a production environment. This configuration supports up to 20 ESXi hosts (~200 events/second or ~3GB/day) and requires the following: * 2 CPUs (minimum 2.0GHz) * 4GB RAM * 132GB of storage (100GB for event storage) - thick provisioned, eager zeroed highly recommended * VM hardware version 7 or greater (vSphere 4.0 or greater) Small This configuration supports up to 100 ESXi hosts (~1000 events/second or ~15GB/day) and requires the following: * 4 CPU (minimum 2.0GHz) * 8GB RAM * 132GB of storage (100GB for event storage) - thick provisioned, eager zeroed highly recommended * VM hardware version 7 or greater (vSphere 4.0 or greater) Medium This configuration supports up to 250 ESXi hosts (~2500 events/second or ~37.5GB/day) and requires the following: * 8 CPU (minimum 2.0GHz) * 16GB RAM * 282GB of storage (250GB for event storage) - thick provisioned, eager zeroed highly recommended * VM hardware version 7 or greater (vSphere 4.0 or greater) Large IMPORTANT: This configuration requires vSphere 5.0 or greater. This configuration supports up to 750 ESXi hosts (~7500 events/second or ~112.5GB/day) and requires the following: * 16 CPU (minimum 2.0GHz) * 32GB RAM * 282GB of storage (250GB for event storage) - thick provisioned, eager zeroed highly recommended * VM hardware version 8 or greater (vSphere 5.0 or greater) .PARAMETER IpAssignment_IpProtocol OvfTypeDescription: string["IPv4"] .PARAMETER NetworkMapping_Network_1 OvfTypeDescription: string The "Network 1" network Option 1: Standard Port Group associated to one host - VirtualPortGroupImpl Option 2: Distributed Port Group associated to vCenter - VmwareVDPortgroupImpl .PARAMETER vami_VMware_vCenter_Log_Insight_DNS OvfTypeDescription: string The domain name servers for this VM (comma separated). Leave blank if DHCP is desired. WARNING: Do not specify more than two DNS entries or no DNS entries will be configured! .PARAMETER vami_VMware_vCenter_Log_Insight_gateway OvfTypeDescription: string The default gateway address for this VM. Leave blank if DHCP is desired. .PARAMETER vami_VMware_vCenter_Log_Insight_hostname OvfTypeDescription: string(0..65535) The hostname or the fully qualified domain name for this VM. Leave blank if DHCP is desired. .PARAMETER vami_VMware_vCenter_Log_Insight_ip0 OvfTypeDescription: string The IP address for this interface. Leave blank if DHCP is desired. .PARAMETER vami_VMware_vCenter_Log_Insight_netmask0 OvfTypeDescription: string The netmask or prefix for this interface. Leave blank if DHCP is desired. .PARAMETER vm_rootpw OvfTypeDescription: password(0..65535) A root password can be set during deployment if desired. If not, but guest customization is running, then it will be randomly generated. Otherwise the password will be blank, and will be required to change in the console before using ssh. For security reasons, it is recommended to use a password that is a minimum of eight characters and contains a minimum of one upper, one lower, one digit, and one special character. .PARAMETER ovfpath Specifies the local path to the OVF or OVA package for which the user-configurable options are returned. URL paths are not supported. #> param( [ValidateSet("xsmall", "small", "medium", "large")] $DeploymentOption = "small", [ValidateSet("IPv4")] $IpAssignment_IpProtocol, $NetworkMapping_Network_1, $vami_VMware_vCenter_Log_Insight_DNS, $vami_VMware_vCenter_Log_Insight_gateway, [ValidateLength(0,65535)] $vami_VMware_vCenter_Log_Insight_hostname, $vami_VMware_vCenter_Log_Insight_ip0, $vami_VMware_vCenter_Log_Insight_netmask0, [ValidateLength(0,65535)] $vm_rootpw, [Parameter(Mandatory=$true,HelpMessage="Enter the local full path including extension to a VMware-vRealize-Log-Insight-2.5.0-2347850.ovf or .ova file. This script has been designed to work only with this package.")] [ValidateScript({($_.split('\')[-1]) -eq 'VMware-vRealize-Log-Insight-2.5.0-2347850.ova' -or ($_.split('\')[-1]) -eq 'VMware-vRealize-Log-Insight-2.5.0-2347850.ovf' })] $ovfpath ) process{ $OvfConfiguration = Get-OvfConfiguration -Ovf $ovfpath if($DeploymentOption){ $OvfConfiguration.DeploymentOption.Value = $DeploymentOption } if($IpAssignment_IpProtocol){ $OvfConfiguration.IpAssignment.IpProtocol.Value = $IpAssignment_IpProtocol } if($NetworkMapping_Network_1){ $OvfConfiguration.NetworkMapping.Network_1.Value = $NetworkMapping_Network_1 } if($vami_VMware_vCenter_Log_Insight_DNS){ $OvfConfiguration.vami.VMware_vCenter_Log_Insight.DNS.Value = $vami_VMware_vCenter_Log_Insight_DNS } if($vami_VMware_vCenter_Log_Insight_gateway){ $OvfConfiguration.vami.VMware_vCenter_Log_Insight.gateway.Value = $vami_VMware_vCenter_Log_Insight_gateway } if($vami_VMware_vCenter_Log_Insight_hostname){ $OvfConfiguration.vami.VMware_vCenter_Log_Insight.hostname.Value = $vami_VMware_vCenter_Log_Insight_hostname } if($vami_VMware_vCenter_Log_Insight_ip0){ $OvfConfiguration.vami.VMware_vCenter_Log_Insight.ip0.Value = $vami_VMware_vCenter_Log_Insight_ip0 } if($vami_VMware_vCenter_Log_Insight_netmask0){ $OvfConfiguration.vami.VMware_vCenter_Log_Insight.netmask0.Value = $vami_VMware_vCenter_Log_Insight_netmask0 } if($vm_rootpw){ $OvfConfiguration.vm.rootpw.Value = $vm_rootpw } Return $OvfConfiguration } }

All information in the ovf or ova package available via get-OvfConfiguration have been “converted” in a PowerShell way.

For example with “VMware-vRealize-Log-Insight-2.5.0-2347850.ova” and the parameter DeploymentOption:
The OvfTypeDescription is: string[“xsmall”, “small”, “medium”, “large”]
The default value is “small”
This will become in the parameter section of the function generated:
param(
[ValidateSet(“xsmall”, “small”, “medium”, “large”)]
$DeploymentOption = “small”,

Maybe you are not interested to deploy an Orchestrator appliance…
So in that case what about generating a function for ANY ovf / ova files?

The script to generate script
Prerequisite:
PowerCLI 5.8 or above
Connection established with one vcenter server

Step 1: Add the function Export-OvfConfigurationSettings
This is a recursive function that uses as a parameter an ovfconfiguration object. It extracts all properties available through Get-OvfConfiguration for every user configurable parameters and return a PSObjectTable.

function Export-OvfConfigurationSettings{
	param(
	$ToAnalyse,
	$PackageName,
	$PropertyPath
	)
	
	Process{	
		If($ToAnalyse | Get-Member -MemberType Property | where {$_.Name -ne "Source"}){

		
					$FinalTable = New-Object -Type PSObject -Prop ([ordered]@{
					"Package" = $PackageName;
					"PropertyPath" = ($PropertyPath.substring(1));
					"DefaultValue" = $ToAnalyse.DefaultValue;
					"Description" = $ToAnalyse.Description ;
					"Key" = $ToAnalyse.Key;
					"OvfTypeDescription" = $ToAnalyse.OvfTypeDescription;
					"Value" = $ToAnalyse.Value;
					})
					Return $FinalTable
		
		
		}
		
		$AllCodeProperty = $ToAnalyse | Get-Member -MemberType CodeProperty
		ForEach($CodeProperty in $AllCodeProperty){
		$CodePropertyName = $CodeProperty.Name
		$PropertyPathForThisCodeProperty = $PropertyPath + "."+ $CodePropertyName
		Export-OvfConfigurationSettings -ToAnalyse $ToAnalyse.$CodePropertyName -PackageName $PackageName -PropertyPath $PropertyPathForThisCodeProperty
		}
		
	}
}

Step 2: Generate the function
I apologize in advance the script is not really “clean”… goal was to have a working script and then improve it based on feedback if any.
Comments are in the code.

$stream.close()

#PLEASE REPLACE ALL VALUES BELOW BASED ON YOUR ENVIRONMENT
#The output file will contain all functions
$OutputFileWithAllFunctions = "C:\Temp\AllFunctionsGeneratedFromOVF_OVA.ps1"
#The top folder where are located all ovf and ova files. The script will go into each subfolder to look for any ovf and ova files.
$RootFolder = "C:\VMware files"
#vCenterServer
$ViServer = "10.0.0.8"
$User = "administrator@vsphere.local" 
$Password = "MyL@b0123"

Remove-Item $OutputFileWithAllFunctions
$Stream = [System.IO.StreamWriter] $OutputFileWithAllFunctions

Connect-VIServer -Server $ViServer -User $User -Password $Password
#or if you can use windows authentication integrated, use the line below instead. 
#Connect-VIServer -Server $ViServer 

	Get-ChildItem -path $RootFolder  -Recurse -include @("*.ova","*.ovf") |  foreach-object{
	$FileName = $_.Name
	$FileNameWithoutExtension = $FileName.Replace(".ova","").Replace(".ovf","")
	
	#This is where we call the get-ovfconfiguration and why a connection to vCenter is mandatory
	$OvfConfiguration = Get-OvfConfiguration -ovf $_.fullname
	
	#The function name is based on the file name. Each function is valid only for this file.
	$FunctionName = "New-OvfConfiguration_" + $FileNameWithoutExtension
	
	$stream.WriteLine("function $FunctionName{")
	
	#HELP SECTION - First part similar for all scripts generated with the exception of the package name
	$stream.WriteLine('<#')		
	$stream.WriteLine('.SYNOPSIS')
	$stream.WriteLine("This PowerCLI cmdlet create a PowerCli object OvfConfiguration specifically designed to be used when importing the $FileNameWithoutExtension ovf/ova package with the Import-VApp cmdlet.")
	$stream.WriteLine("It relies on the get-ovfconfiguration PowerCli cmdlet")
	$stream.WriteLine('')
	
	$stream.WriteLine('.DESCRIPTION')
	$stream.WriteLine('This function is based on the original get-ovfconfiguration PowerCLI cmdlet...')
	$stream.WriteLine("...and convert it in a Powershell friendly function specifically for the package $FileNameWithoutExtension")
	$stream.WriteLine("It is mandatory to be connected to one vCenter or Get-OvfConfiguration will throw an error")
	$stream.WriteLine('')

	$stream.WriteLine('.NOTES')
	$stream.WriteLine('Author: Christophe Calvet')
	$stream.WriteLine('Blog: http://www.thecrazyconsultant.com/Get-OvfConfiguration_on_steroids')
	$stream.WriteLine('')
	
	$stream.WriteLine('.LINK')
	$stream.WriteLine("This function has been generated by script for a $FileNameWithoutExtension ovf/ova package.")
	$stream.WriteLine("The script used to create this function is available at the link below, and can be used for any ovf/ova packages.")
	$stream.WriteLine('http://www.thecrazyconsultant.com/Get-OvfConfiguration_on_steroids')
	$stream.WriteLine("Documentation for the original get-ovfconfiguration")
	$stream.WriteLine('http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.powercli.cmdletref.doc/Get-OvfConfiguration.html')
	$stream.WriteLine("Link for a good overview of get-ovfconfiguration")
	$stream.WriteLine('http://blogs.vmware.com/PowerCLI/2014/09/powercli-5-8-new-feature-get-ovfconfiguration-part-1-2.html')
	$stream.WriteLine('')
	
	#HELP SECTION - Create help for each parameter available for this ovfPackage
	$AllParametersForThisPackage = Export-OvfConfigurationSettings -ToAnalyse $OvfConfiguration -PackageName $FileNameWithoutExtension

		$AllParametersForThisPackage | foreach-object{
		$PropertyPathWithoutDot = ".PARAMETER " + ($_.PropertyPath).replace(".","_") #It seems that PowerShell doesn't like "." in a parameter name.
		$stream.WriteLine($PropertyPathWithoutDot)
		$OvfTypeDescription = "OvfTypeDescription: " + $_.OvfTypeDescription #Each time the OvfTypeDescription will be displayed and then the Description if any available.
		$stream.WriteLine($OvfTypeDescription)
		If($_.Description){
		$Description = $_.Description
		$stream.WriteLine($Description)
		}
			#Information added to provide more information to user.
			If($_.PropertyPath -match "NetworkMapping"){
			$stream.WriteLine("Option 1: Standard Port Group associated to one host - VirtualPortGroupImpl")
			$stream.WriteLine("Option 2: Distributed Port Group associated to vCenter - VmwareVDPortgroupImpl")
			}
		$stream.WriteLine("")
		}
		$NewOutputWithTab = ".PARAMETER ovfpath"
		$stream.WriteLine($NewOutputWithTab)
		$Description = "Specifies the local path to the OVF or OVA package for which the user-configurable options are returned. URL paths are not supported."
		$stream.WriteLine($Description)
		
	$stream.WriteLine('#>')
	#PARAM SECTION - Create all parameters and add some logic to convert ovfDescription in relevant PowerShell parameters.
		$NewOutputWithTab = "`t" +'param('
		$stream.WriteLine($NewOutputWithTab)
			$AllParametersForThisPackage | foreach-object{
				$PropertyPathWithoutDot = ($_.PropertyPath).replace(".","_")
					#The test below will identify a scenario like - string["IPv4", "IPv6"] - and convert to [ValidateSet("IPv4", "IPv6")]
					If($_.OvfTypeDescription -like 'string`[*'){
					$NewOutputWithTab = "`t" + '[' + (($_.OvfTypeDescription).replace('string[','ValidateSet(')).replace('"]','")') + ']'
					$stream.WriteLine($NewOutputWithTab)
					}
					If($_.OvfTypeDescription -like 'string`(*'){
						#The test below will identify a scenario like - string(0..65535) - and convert to [ValidateLength(0,65535)]
						If($_.OvfTypeDescription -notlike '*..`)'){
						$NewOutputWithTab = "`t" + '[' + (($_.OvfTypeDescription).replace('string','ValidateLength').replace('..',',')) + ']'
						$stream.WriteLine($NewOutputWithTab)
						}
						#The test below will identify a scenario like - string(1..) - and convert to [ValidateScript({ $_.Length -ge 1})]
						Else{
						$MinimumValue = $_.OvfTypeDescription.replace('string(','').replace('..)','')
						$NewOutputWithTab = "`t" + '[ValidateScript({ $_.Length -ge ' + $MinimumValue +'})]'
						$stream.WriteLine($NewOutputWithTab)
						}
					}
					If($_.OvfTypeDescription -like 'password`(*'){
						#The test below will identify a scenario like - password(8..256) - and convert to [ValidateLength(8,256)]
						If($_.OvfTypeDescription -notlike '*..`)'){
						$NewOutputWithTab = "`t" + '[' + (($_.OvfTypeDescription).replace('password','ValidateLength').replace('..',',')) + ']'
						$stream.WriteLine($NewOutputWithTab)
						}
						#The test below will identify a scenario like - password(1..) - and convert to [ValidateScript({ $_.Length -ge 1})]
						Else{
						$MinimumValue = $_.OvfTypeDescription.replace('password(','').replace('..)','')
						$NewOutputWithTab = "`t" + '[ValidateScript({ $_.Length -ge ' + $MinimumValue +'})]'
						$stream.WriteLine($NewOutputWithTab)
						}
					}
					
					#
					$NewOutputWithTab = "`t" 
					If($_.OvfTypeDescription -eq "boolean"){
					$NewOutputWithTab = $NewOutputWithTab + '[boolean]'
					}
					$NewOutputWithTab  = $NewOutputWithTab + '$' + "$PropertyPathWithoutDot"
					
					#Analyse if there is any default value for this parameter
					If($_.DefaultValue){
						#For a boolean "False" as a default value is not good we need to use $False instead
						If($_.OvfTypeDescription -eq "boolean"){
						$NewOutputWithTab  = $NewOutputWithTab + ' = $' + $_.DefaultValue
						}
						Else{
						$NewOutputWithTab  = $NewOutputWithTab + ' = "' + $_.DefaultValue + '"'
						}
					}
					$NewOutputWithTab  = $NewOutputWithTab + "," 
					$stream.WriteLine($NewOutputWithTab)
			}
					$NewOutputWithTab = "`t" + '[Parameter(Mandatory=$true,HelpMessage="Enter the local full path including extension to a '+ $FileNameWithoutExtension +'.ovf or .ova file. This script has been designed to work only with this package.")]'
					$stream.WriteLine($NewOutputWithTab)
					#A little extra check to avoid human mistake when adding and ova not valid for this function.
					#It means also that you should not modify the default name of the ova/ovf files after the creation of the function.
					$NewOutputWithTab = "`t" + '[ValidateScript({($_.split(''\'')[-1]) -eq ''' + $FileNameWithoutExtension + '.ova'' -or ($_.split(''\'')[-1]) -eq ''' + $FileNameWithoutExtension +  '.ovf'' })]'
					$stream.WriteLine($NewOutputWithTab)
					$NewOutputWithTab = "`t" + '$ovfpath'
					$stream.WriteLine($NewOutputWithTab)
		$NewOutputWithTab = "`t" + ')'
		$stream.WriteLine($NewOutputWithTab)
		
	#PROCESS SECTION If the user has not called a function with a specific parameter and there is no default value the associated setting will not be configured in the ovfconfiguration
				$NewOutputWithTab = "`t" +'process{'
				$stream.WriteLine($NewOutputWithTab)

				$NewOutputWithTab = "`t" + '$OvfConfiguration = Get-OvfConfiguration -Ovf $ovfpath'
				$stream.WriteLine($NewOutputWithTab)
				$stream.WriteLine('')
				
				$AllParametersForThisPackage | foreach-object{	
				$PropertyPathWithoutDot = ($_.PropertyPath).replace(".","_")
				
				$NewOutputWithTab = "`t" + 'if($' + $PropertyPathWithoutDot + '){'
				$stream.WriteLine($NewOutputWithTab)
				
				$NewOutputWithTab = "`t" + '$OvfConfiguration.' + $_.PropertyPath + ".Value = " + '$' + $PropertyPathWithoutDot
				$stream.WriteLine($NewOutputWithTab)
				
				$NewOutputWithTab = "`t" + '}'
				$stream.WriteLine($NewOutputWithTab)				
				
				}

				$stream.WriteLine("")
				
				$NewOutputWithTab = "`t" + 'Return $OvfConfiguration'
				$stream.WriteLine($NewOutputWithTab)
				
				
				$NewOutputWithTab = "`t" +'}'
				$stream.WriteLine($NewOutputWithTab)
	
		
	$stream.WriteLine("}")
	$stream.WriteLine('')
	}


DIsconnect-VIServer -Server $ViServer  -confirm:$False

$Stream.close()
#Enjoy

Notes:
[System.IO.StreamWriter] has been used to write faster the output file according to this post.
powershell-and-writing-files-how-fast-can-you-write-to-a-file

The function generated should help you to understand faster what is the role of each parameters and will prevent you in some case to enter wrong values.
This is the case with validateset for example, a typo mistake will be identified even before trying to import the vapp.
This will be however only as good as the ovf definition.

Finally I strongly recommend the following links that are closely related to this topic.
deploying-log-insight-powercli-5-8-r1-new-features written by Alan Renouf
PowerCLI-Deployment the associated Github project

FAQ:
Why using long parameter name like “vami_VMware_vRealize_Orchestrator_Appliance_ip0” instead of “ip0”?

Unfortunately for some package the last part is not unique. This is the case with “vCenter-hyperic-5.8.4-EE”
$OvfConfiguration.vami.vCenter_Hyperic_Server.ip0.Value
$OvfConfiguration.vami.vFabric_vPostgres_DB.ip0.Value
It should be possible to check for duplicate and only use the full name when needed however I am not really sure if it is worth the extra work.
Especially when the full parameter name helps to identify its purpose.

I have some suggestions.
Good news. I am still in a learning process, so any good advice will be welcomed for the future updates of this script, which will then be available for everyone.

Bonus: Generate an ovfconfiguration for vCenter Appliance 6
Mount the VMware-VCSA-all-6.0.0-2562643.iso
Copy the file “CD drive\vcsa\ vmware-vcsa” to a local folder.
This file is actually an ova package
Unzip the file and you will find the “VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10.ovf”
You can then rename the file “vmware-vcsa” as “VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10.ova”
You will find below the function generated for this package.

function New-OvfConfiguration_VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10{
<#
.SYNOPSIS
This PowerCLI cmdlet create a PowerCli object OvfConfiguration specifically designed to be used when importing the VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10 ovf/ova package with the Import-VApp cmdlet.
It relies on the get-ovfconfiguration PowerCli cmdlet

.DESCRIPTION
This function is based on the original get-ovfconfiguration PowerCLI cmdlet...
...and convert it in a Powershell friendly function specifically for the package VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10
It is mandatory to be connected to one vCenter or Get-OvfConfiguration will throw an error

.NOTES
Author: Christophe Calvet
Blog: http://www.thecrazyconsultant.com/Get-OvfConfiguration_on_steroids

.LINK
This function has been generated by script for a VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10 ovf/ova package.
The script used to create this function is available at the link below, and can be used for any ovf/ova packages.
Get-OvfConfiguration on steroids
Documentation for the original get-ovfconfiguration http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.powercli.cmdletref.doc/Get-OvfConfiguration.html Link for a good overview of get-ovfconfiguration http://blogs.vmware.com/PowerCLI/2014/09/powercli-5-8-new-feature-get-ovfconfiguration-part-1-2.html .PARAMETER Common_guestinfo_cis_appliance_net_addr_family OvfTypeDescription: string Network IP address family (i.e., 'ipv4' or 'ipv6'). .PARAMETER Common_guestinfo_cis_appliance_net_addr_1 OvfTypeDescription: string Network IP address. Only provide this when mode is 'static'. Can be IPv4 or IPv6 based on specified address family. .PARAMETER Common_guestinfo_cis_appliance_net_dns_servers OvfTypeDescription: string Comma separated list of IP addresses of DNS servers. .PARAMETER Common_guestinfo_cis_appliance_net_gateway OvfTypeDescription: string IP address of default gateway. Can be 'default' when using IPv6. .PARAMETER Common_guestinfo_cis_appliance_net_mode OvfTypeDescription: string Network mode (i.e., 'static', 'dhcp', or 'autoconf' (IPv6 only). .PARAMETER Common_guestinfo_cis_appliance_net_pnid OvfTypeDescription: string Network identity (IP address or fully-qualified domain name) services should use when advertising themselves. .PARAMETER Common_guestinfo_cis_appliance_net_ports OvfTypeDescription: string A string encoding a JSON object mapping port names to port numbers. .PARAMETER Common_guestinfo_cis_appliance_net_prefix OvfTypeDescription: string Network prefix length. Only provide this when mode is 'static'. 0-32 for IPv4. 0-128 for IPv6. .PARAMETER Common_guestinfo_cis_appliance_ntp_servers OvfTypeDescription: string A comma-seperated list of hostnames or IP addresses of NTP Servers .PARAMETER Common_guestinfo_cis_appliance_root_passwd OvfTypeDescription: password Password to assign to root account. If blank, password can be set on the console. .PARAMETER Common_guestinfo_cis_appliance_ssh_enabled OvfTypeDescription: boolean Set whether SSH-based remote login is enabled. This configuration can be changed after deployment. .PARAMETER Common_guestinfo_cis_appliance_time_tools_sync OvfTypeDescription: boolean Set whether VMware tools based time synchronization should be used. This parameter is ignored if appliance.ntp.servers is not empty. .PARAMETER Common_guestinfo_cis_clientlocale OvfTypeDescription: string This parameter specifies the client locale. Supported locales are en, fr, ja, ko, zh_CN and zh_TW. English is assumed if locale is unknown. .PARAMETER Common_guestinfo_cis_db_instance OvfTypeDescription: string String describing the external database instance. Values could be anything depending on what the database instance name the DBA creates in the external db. (ignored when the db.type is 'embedded'). .PARAMETER Common_guestinfo_cis_db_password OvfTypeDescription: string String providing the password to use when connecting to external database (ignored when db.type is 'embedded'). .PARAMETER Common_guestinfo_cis_db_provider OvfTypeDescription: string String describing the external database provider. The only supported value is 'oracle' (ignored when the db.type is 'embedded'). .PARAMETER Common_guestinfo_cis_db_servername OvfTypeDescription: string String naming the the hostname of the server on which the external database is running (ignored when db.type is 'embedded'). .PARAMETER Common_guestinfo_cis_db_serverport OvfTypeDescription: string String describing the port on the host on which the external database is running (ignored when db.type is 'embedded'). .PARAMETER Common_guestinfo_cis_db_type OvfTypeDescription: string String indicating whether the database is 'embedded' or 'external'. .PARAMETER Common_guestinfo_cis_db_user OvfTypeDescription: string String naming the account to use when connecting to external database (ignored when db.type is 'embedded'). .PARAMETER Common_guestinfo_cis_kv_new OvfTypeDescription: boolean If this parameter is set to True, then all clients will leverage the new local KV store, else they will continue to use the old GemFire based KV store. Only available in obj and beta builds. Also, this parameter will be removed when we do a final switch-over to the new local KV store and get rid of GemFire based KV .PARAMETER Common_guestinfo_cis_lookup_hidessltrust OvfTypeDescription: boolean If this parameter is set to True, then all lookup service will return endpoints without SSL trust. Can be used for testing VECS integration. .PARAMETER Common_guestinfo_cis_system_vm0_hostname OvfTypeDescription: string When deploying a vCenter Server Node, please provide the FQDN or IP address of a Platform Services Controller (leave blank otherwise). The choice of FQDN versus IP address is decided based on the Platform Services Controller's own notion of its network identity. .PARAMETER Common_guestinfo_cis_system_vm0_port OvfTypeDescription: string When deploying a vCenter Server pointing to an external platform services controller, please provide the HTTPS port of the external platform services controller if a custom port number is being used. The default HTTPS port number is 443. .PARAMETER Common_guestinfo_cis_upgrade_silent OvfTypeDescription: string Suppress questions and use default answers .PARAMETER Common_guestinfo_cis_upgrade_source_export_directory OvfTypeDescription: string Folder on the source appliance, where to store migrate data. Optional. Set only for upgrade .PARAMETER Common_guestinfo_cis_upgrade_source_guest_password OvfTypeDescription: string Password for the appliance operating system to upgrade. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_guest_user OvfTypeDescription: string Username for the appliance operating system to upgrade. Usually root. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_guestops_host_addr OvfTypeDescription: string IP/hostname of the host that manages appliance to upgrade. Can be either vCenter or ESX host. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_guestops_host_password OvfTypeDescription: string Password for the host that manages appliance to upgrade. Can be either vCenter or ESX host. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_guestops_host_user OvfTypeDescription: string Username for the host that manages appliance to upgrade. Can be either vCenter or ESX host. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_ssl_thumbprint OvfTypeDescription: string Thumbprint for the SSL certificate of the host that manages the appliance to upgrade. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_vpxd_ip OvfTypeDescription: string IP/hostname of the appliance to upgrade. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_vpxd_password OvfTypeDescription: string vCenter password for the appliance to upgrade. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_source_vpxd_user OvfTypeDescription: string vCenter username for the appliance to upgrade. Set only for upgrade. .PARAMETER Common_guestinfo_cis_upgrade_user_options OvfTypeDescription: string Advanced upgrade settings specified in json format. Optional. Set only for upgrade .PARAMETER Common_guestinfo_cis_vmdir_domain_name OvfTypeDescription: string For the first instance of the identity domain, this is the name of the newly created domain. .PARAMETER Common_guestinfo_cis_vmdir_first_instance OvfTypeDescription: boolean If this parameter is set to True, the VMware directory instance is setup as the first instance of a new identity domain. Otherwise, the instance is setup as a replication partner. .PARAMETER Common_guestinfo_cis_vmdir_password OvfTypeDescription: password For the first instance of the identity domain, this is the password given to the Administrator account. Otherwise, this is the password of the Administrator account of the replication partner. .PARAMETER Common_guestinfo_cis_vmdir_replication_partner_hostname OvfTypeDescription: string The hostname of the VMware directory replication partner. This value is ignored for the first instance of the identity domain. .PARAMETER Common_guestinfo_cis_vmdir_site_name OvfTypeDescription: string Name of site. Use 'Default-First-Site' to define a new site. .PARAMETER DeploymentOption OvfTypeDescription: string["tiny", "small", "medium", "large", "management-tiny", "management-small", "management-medium", "management-large", "infrastructure"] Tiny (up to 10 hosts, 100 VMs) This will deploy a Tiny VM configured with 2 vCPUs and 8 GB of memory and requires 120 GB of disk space. This option contains vCenter Server with an embedded Platform Services Controller. Small (up to 100 hosts, 1,000 VMs) This will deploy a Small VM configured with 4 vCPUs and 16 GB of memory and requires 150 GB of disk space. This option contains vCenter Server with an embedded Platform Services Controller. Medium (up to 400 hosts, 4,000 VMs) This will deploy a Medium VM configured with 8 vCPUs and 24 GB of memory and requires 300 GB of disk space. This option contains vCenter Server with an embedded Platform Services Controller. Large (up to 1000 hosts, 10,000 VMs) This will deploy a Large VM configured with 16 vCPUs and 32 GB of memory and requires 450 GB of disk space. This option contains vCenter Server with an embedded Platform Services Controller. Tiny (up to 10 hosts, 100 VMs) This will deploy a Tiny VM configured with 2 vCPUs and 8 GB of memory and requires 120 GB of disk space. These resources will be used by the vCenter Server services. Small (up to 100 hosts, 1,000 VMs) This will deploy a Small VM configured with 4 vCPUs and 16 GB of memory and requires 150 GB of disk space. These resources will be used by the vCenter Server services. Medium (up to 400 hosts, 4,000 VMs) This will deploy a Medium VM configured with 8 vCPUs and 24 GB of memory and requires 300 GB of disk space. These resources will be used by the vCenter Server services. Large (up to 1000 hosts, 10,000 VMs) This will deploy a Large VM configured with 16 vCPUs and 32 GB of memory and requires 450 GB of disk space. These resources will be used by the vCenter Server services. Platform Services Controller This will deploy an external Platform Services Controller VM with 2 vCPU and 2GB of memory and requires 30 GB of disk space. .PARAMETER IpAssignment_IpProtocol OvfTypeDescription: string["IPv4", "IPv6"] .PARAMETER NetworkMapping_Network_1 OvfTypeDescription: string The "Network 1" network Option 1: Standard Port Group associated to one host - VirtualPortGroupImpl Option 2: Distributed Port Group associated to vCenter - VmwareVDPortgroupImpl .PARAMETER vami_VMware_vCenter_Server_Appliance_DNS OvfTypeDescription: string The domain name servers for this VM (comma separated). Leave blank if DHCP is desired. .PARAMETER vami_VMware_vCenter_Server_Appliance_gateway OvfTypeDescription: string The default gateway address for this VM. Leave blank if DHCP is desired. .PARAMETER vami_VMware_vCenter_Server_Appliance_ip0 OvfTypeDescription: string The IP address for this interface. Leave blank if DHCP is desired. .PARAMETER vami_VMware_vCenter_Server_Appliance_netmask0 OvfTypeDescription: string The netmask or prefix for this interface. Leave blank if DHCP is desired. .PARAMETER ovfpath Specifies the local path to the OVF or OVA package for which the user-configurable options are returned. URL paths are not supported. #> param( $Common_guestinfo_cis_appliance_net_addr_family, $Common_guestinfo_cis_appliance_net_addr_1, $Common_guestinfo_cis_appliance_net_dns_servers, $Common_guestinfo_cis_appliance_net_gateway, $Common_guestinfo_cis_appliance_net_mode, $Common_guestinfo_cis_appliance_net_pnid, $Common_guestinfo_cis_appliance_net_ports = "{}", $Common_guestinfo_cis_appliance_net_prefix, $Common_guestinfo_cis_appliance_ntp_servers, $Common_guestinfo_cis_appliance_root_passwd, [boolean]$Common_guestinfo_cis_appliance_ssh_enabled = $False, [boolean]$Common_guestinfo_cis_appliance_time_tools_sync = $False, $Common_guestinfo_cis_clientlocale = "en", $Common_guestinfo_cis_db_instance, $Common_guestinfo_cis_db_password, $Common_guestinfo_cis_db_provider, $Common_guestinfo_cis_db_servername, $Common_guestinfo_cis_db_serverport, $Common_guestinfo_cis_db_type = "embedded", $Common_guestinfo_cis_db_user, [boolean]$Common_guestinfo_cis_kv_new = $True, [boolean]$Common_guestinfo_cis_lookup_hidessltrust = $False, $Common_guestinfo_cis_system_vm0_hostname, $Common_guestinfo_cis_system_vm0_port = "443", $Common_guestinfo_cis_upgrade_silent = "False", $Common_guestinfo_cis_upgrade_source_export_directory = "/var/tmp", $Common_guestinfo_cis_upgrade_source_guest_password, $Common_guestinfo_cis_upgrade_source_guest_user, $Common_guestinfo_cis_upgrade_source_guestops_host_addr, $Common_guestinfo_cis_upgrade_source_guestops_host_password, $Common_guestinfo_cis_upgrade_source_guestops_host_user, $Common_guestinfo_cis_upgrade_source_ssl_thumbprint, $Common_guestinfo_cis_upgrade_source_vpxd_ip, $Common_guestinfo_cis_upgrade_source_vpxd_password, $Common_guestinfo_cis_upgrade_source_vpxd_user, $Common_guestinfo_cis_upgrade_user_options, $Common_guestinfo_cis_vmdir_domain_name = "vsphere.local", [boolean]$Common_guestinfo_cis_vmdir_first_instance = $True, $Common_guestinfo_cis_vmdir_password, $Common_guestinfo_cis_vmdir_replication_partner_hostname, $Common_guestinfo_cis_vmdir_site_name = "Default-First-Site", [ValidateSet("tiny", "small", "medium", "large", "management-tiny", "management-small", "management-medium", "management-large", "infrastructure")] $DeploymentOption = "tiny", [ValidateSet("IPv4", "IPv6")] $IpAssignment_IpProtocol, $NetworkMapping_Network_1, $vami_VMware_vCenter_Server_Appliance_DNS, $vami_VMware_vCenter_Server_Appliance_gateway, $vami_VMware_vCenter_Server_Appliance_ip0, $vami_VMware_vCenter_Server_Appliance_netmask0, [Parameter(Mandatory=$true,HelpMessage="Enter the local full path including extension to a VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10.ovf or .ova file. This script has been designed to work only with this package.")] [ValidateScript({($_.split('\')[-1]) -eq 'VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10.ova' -or ($_.split('\')[-1]) -eq 'VMware-vCenter-Server-Appliance-6.0.0.5100-2562625_OVF10.ovf' })] $ovfpath ) process{ $OvfConfiguration = Get-OvfConfiguration -Ovf $ovfpath if($Common_guestinfo_cis_appliance_net_addr_family){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.addr.family.Value = $Common_guestinfo_cis_appliance_net_addr_family } if($Common_guestinfo_cis_appliance_net_addr_1){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.addr_1.Value = $Common_guestinfo_cis_appliance_net_addr_1 } if($Common_guestinfo_cis_appliance_net_dns_servers){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.dns.servers.Value = $Common_guestinfo_cis_appliance_net_dns_servers } if($Common_guestinfo_cis_appliance_net_gateway){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.gateway.Value = $Common_guestinfo_cis_appliance_net_gateway } if($Common_guestinfo_cis_appliance_net_mode){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.mode.Value = $Common_guestinfo_cis_appliance_net_mode } if($Common_guestinfo_cis_appliance_net_pnid){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.pnid.Value = $Common_guestinfo_cis_appliance_net_pnid } if($Common_guestinfo_cis_appliance_net_ports){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.ports.Value = $Common_guestinfo_cis_appliance_net_ports } if($Common_guestinfo_cis_appliance_net_prefix){ $OvfConfiguration.Common.guestinfo.cis.appliance.net.prefix.Value = $Common_guestinfo_cis_appliance_net_prefix } if($Common_guestinfo_cis_appliance_ntp_servers){ $OvfConfiguration.Common.guestinfo.cis.appliance.ntp.servers.Value = $Common_guestinfo_cis_appliance_ntp_servers } if($Common_guestinfo_cis_appliance_root_passwd){ $OvfConfiguration.Common.guestinfo.cis.appliance.root.passwd.Value = $Common_guestinfo_cis_appliance_root_passwd } if($Common_guestinfo_cis_appliance_ssh_enabled){ $OvfConfiguration.Common.guestinfo.cis.appliance.ssh.enabled.Value = $Common_guestinfo_cis_appliance_ssh_enabled } if($Common_guestinfo_cis_appliance_time_tools_sync){ $OvfConfiguration.Common.guestinfo.cis.appliance.time.tools_sync.Value = $Common_guestinfo_cis_appliance_time_tools_sync } if($Common_guestinfo_cis_clientlocale){ $OvfConfiguration.Common.guestinfo.cis.clientlocale.Value = $Common_guestinfo_cis_clientlocale } if($Common_guestinfo_cis_db_instance){ $OvfConfiguration.Common.guestinfo.cis.db.instance.Value = $Common_guestinfo_cis_db_instance } if($Common_guestinfo_cis_db_password){ $OvfConfiguration.Common.guestinfo.cis.db.password.Value = $Common_guestinfo_cis_db_password } if($Common_guestinfo_cis_db_provider){ $OvfConfiguration.Common.guestinfo.cis.db.provider.Value = $Common_guestinfo_cis_db_provider } if($Common_guestinfo_cis_db_servername){ $OvfConfiguration.Common.guestinfo.cis.db.servername.Value = $Common_guestinfo_cis_db_servername } if($Common_guestinfo_cis_db_serverport){ $OvfConfiguration.Common.guestinfo.cis.db.serverport.Value = $Common_guestinfo_cis_db_serverport } if($Common_guestinfo_cis_db_type){ $OvfConfiguration.Common.guestinfo.cis.db.type.Value = $Common_guestinfo_cis_db_type } if($Common_guestinfo_cis_db_user){ $OvfConfiguration.Common.guestinfo.cis.db.user.Value = $Common_guestinfo_cis_db_user } if($Common_guestinfo_cis_kv_new){ $OvfConfiguration.Common.guestinfo.cis.kv.new.Value = $Common_guestinfo_cis_kv_new } if($Common_guestinfo_cis_lookup_hidessltrust){ $OvfConfiguration.Common.guestinfo.cis.lookup.hidessltrust.Value = $Common_guestinfo_cis_lookup_hidessltrust } if($Common_guestinfo_cis_system_vm0_hostname){ $OvfConfiguration.Common.guestinfo.cis.system.vm0.hostname.Value = $Common_guestinfo_cis_system_vm0_hostname } if($Common_guestinfo_cis_system_vm0_port){ $OvfConfiguration.Common.guestinfo.cis.system.vm0.port.Value = $Common_guestinfo_cis_system_vm0_port } if($Common_guestinfo_cis_upgrade_silent){ $OvfConfiguration.Common.guestinfo.cis.upgrade.silent.Value = $Common_guestinfo_cis_upgrade_silent } if($Common_guestinfo_cis_upgrade_source_export_directory){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.export.directory.Value = $Common_guestinfo_cis_upgrade_source_export_directory } if($Common_guestinfo_cis_upgrade_source_guest_password){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.guest.password.Value = $Common_guestinfo_cis_upgrade_source_guest_password } if($Common_guestinfo_cis_upgrade_source_guest_user){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.guest.user.Value = $Common_guestinfo_cis_upgrade_source_guest_user } if($Common_guestinfo_cis_upgrade_source_guestops_host_addr){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.guestops.host.addr.Value = $Common_guestinfo_cis_upgrade_source_guestops_host_addr } if($Common_guestinfo_cis_upgrade_source_guestops_host_password){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.guestops.host.password.Value = $Common_guestinfo_cis_upgrade_source_guestops_host_password } if($Common_guestinfo_cis_upgrade_source_guestops_host_user){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.guestops.host.user.Value = $Common_guestinfo_cis_upgrade_source_guestops_host_user } if($Common_guestinfo_cis_upgrade_source_ssl_thumbprint){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.ssl.thumbprint.Value = $Common_guestinfo_cis_upgrade_source_ssl_thumbprint } if($Common_guestinfo_cis_upgrade_source_vpxd_ip){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.vpxd.ip.Value = $Common_guestinfo_cis_upgrade_source_vpxd_ip } if($Common_guestinfo_cis_upgrade_source_vpxd_password){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.vpxd.password.Value = $Common_guestinfo_cis_upgrade_source_vpxd_password } if($Common_guestinfo_cis_upgrade_source_vpxd_user){ $OvfConfiguration.Common.guestinfo.cis.upgrade.source.vpxd.user.Value = $Common_guestinfo_cis_upgrade_source_vpxd_user } if($Common_guestinfo_cis_upgrade_user_options){ $OvfConfiguration.Common.guestinfo.cis.upgrade.user.options.Value = $Common_guestinfo_cis_upgrade_user_options } if($Common_guestinfo_cis_vmdir_domain_name){ $OvfConfiguration.Common.guestinfo.cis.vmdir.domain_name.Value = $Common_guestinfo_cis_vmdir_domain_name } if($Common_guestinfo_cis_vmdir_first_instance){ $OvfConfiguration.Common.guestinfo.cis.vmdir.first_instance.Value = $Common_guestinfo_cis_vmdir_first_instance } if($Common_guestinfo_cis_vmdir_password){ $OvfConfiguration.Common.guestinfo.cis.vmdir.password.Value = $Common_guestinfo_cis_vmdir_password } if($Common_guestinfo_cis_vmdir_replication_partner_hostname){ $OvfConfiguration.Common.guestinfo.cis.vmdir.replication_partner_hostname.Value = $Common_guestinfo_cis_vmdir_replication_partner_hostname } if($Common_guestinfo_cis_vmdir_site_name){ $OvfConfiguration.Common.guestinfo.cis.vmdir.site_name.Value = $Common_guestinfo_cis_vmdir_site_name } if($DeploymentOption){ $OvfConfiguration.DeploymentOption.Value = $DeploymentOption } if($IpAssignment_IpProtocol){ $OvfConfiguration.IpAssignment.IpProtocol.Value = $IpAssignment_IpProtocol } if($NetworkMapping_Network_1){ $OvfConfiguration.NetworkMapping.Network_1.Value = $NetworkMapping_Network_1 } if($vami_VMware_vCenter_Server_Appliance_DNS){ $OvfConfiguration.vami.VMware_vCenter_Server_Appliance.DNS.Value = $vami_VMware_vCenter_Server_Appliance_DNS } if($vami_VMware_vCenter_Server_Appliance_gateway){ $OvfConfiguration.vami.VMware_vCenter_Server_Appliance.gateway.Value = $vami_VMware_vCenter_Server_Appliance_gateway } if($vami_VMware_vCenter_Server_Appliance_ip0){ $OvfConfiguration.vami.VMware_vCenter_Server_Appliance.ip0.Value = $vami_VMware_vCenter_Server_Appliance_ip0 } if($vami_VMware_vCenter_Server_Appliance_netmask0){ $OvfConfiguration.vami.VMware_vCenter_Server_Appliance.netmask0.Value = $vami_VMware_vCenter_Server_Appliance_netmask0 } Return $OvfConfiguration } }

3 thoughts on “Get-OvfConfiguration on steroids

  1. Pingback: VCSA on VMware Workstation with Hostname not IP Address | Dave's Notepad

Leave a Reply

Your email address will not be published. Required fields are marked *