How to update Photon OS 3.x Root Password History?


Sometimes it’s annoying when Photon OS based appliances doesn’t allow to use previously used password for root user. You may see the error ‘Password has been already used. Choose another‘ when you try to use the password which was used earlier.

[email protected] [ ~ ]# passwd
New password:
Retype new password:
Password has been already used. Choose another.

By default, Photon OS remember last Five passwords. You can see the setting ‘remember=3’ in /etc/pam.d/system-password

[email protected] [ ~ ]# cat /etc/pam.d/system-password
# Begin /etc/pam.d/system-password
password    requisite   pam_cracklib.so     minlen=8 minclass=4 difok=4 maxsequence=0 retry=3 enforce_for_root
password    requisite   pam_pwhistory.so    retry=3 remember=5 enforce_for_root
password    required    pam_unix.so         sha512 shadow use_authtok
# End /etc/pam.d/system-password

By changing ‘remember ‘ from 5 to 0 we can disable the remember password count and reset the root password.

Upgrade vRealize Operations Tenant App to 8.6 Using the Offline Upgrade Image

In this blog post, I am going to review the process of updating a vRealize Oprations Tenant App for VMware Cloud Director 2.6 virtual appliance to version 8.6.

  1. First, Download vROps Tenant App 8.6 offline upgrade ISO from VMware marketplace. The Upgrade bundle is available in following URL > Resource & Support > ‘Offline Upgrade: vRealize Operations TA 8.6’

    https://marketplace.cloud.vmware.com/services/details/vrealize-operations-tenant-app-for-vmware-cloud-director-2-61211?slug=true
  2. Take a snapshot of the Tenant App appliance.
  3. Connect the ISO to the Tenant App appliance. You can use ‘Client Device’, ‘Host Device’, ‘Datastore ISO file’ or ‘Content Library ISO FIle’ for mounting the ISO.
  4. n a Web browser, log in to the virtual appliance management interface (VAMI). The URL for the VAMI is https:// tenantapp_appliance_address:5480
  5. Click the Update tab.
  6. Click Settings, select Use CDROM Updates, and click Save Settings.
  7. Click Status and click Check Updates. The appliance version appears in the list of available updates.

8. Click Install Updates and click OK. It will take a while to complete the upgrade.

9. After the updates install, click the System tab and click Reboot
10. After reboot confirm the Tenant App version is 8.6.

Upgrade VMware Cloud Director App Launchpad from 2.0 to 2.1

Please find the steps to upgrade VMware Cloud Director App Launchpad from version 2.0 to 2.1

  1. Download VMware Cloud Director App Launchpad 2.1 RPM package from here.
  2. Upload it to the App Launchpad VM.
  3. Open an SSH connection to the App Launchpad VM and log in as root.
  4. Upgrade the RPM package.
[[email protected] ~]# rpm -U vmware-alp-2.1.0-18834930.x86_64.rpm
warning: vmware-alp-2.1.0-18834930.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID 001e5cc9: NOKEY
Upgrading...

Execute 'alp upgrade' to upgrade ...

  Append the excute permission to the existing logs...

5. Run the following command to upgrade App Launchpad.

[[email protected] ~]# alp upgrade --admin-user [email protected] --admin-pass 'passwd'
Upgraded the plugin of App Launchpad successfully.

Upgraded the management service successfully.
  [Upgrade Task]
     CREATE_ENTITY_TYPE_CATALOG_INFO : true
     MIGRATE_CATALOGS : true
     CREATE_ENTITY_TYPE_SIZING_TEMPLATE : true
     MIGRATE_LEGACY_SIZING_TEMPLATES : true
     CREATE_ENTITY_TYPE_MARKETPLACE_BANNER : true
     CREATE_ENTITY_TYPE_ORG_METRICS : true
     UPGRADE_SERVICE_ROLE : true

6. Restart alp service and confirm its running.

[[email protected]~]# systemctl restart alp
[[email protected] ~]# systemctl status alp
● alp.service - VMware ALP Management Service
   Loaded: loaded (/usr/lib/systemd/system/alp.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-11-18 11:46:14 +01; 14s ago
 Main PID: 29334 (java)
   CGroup: /system.slice/alp.service
           └─29334 java -jar /opt/vmware/alp/alp.jar --logging.path=log

Nov 18 11:46:14 bd1-srp-al01.acs.local systemd[1]: Stopped VMware ALP Management Service.
Nov 18 11:46:14 bd1-srp-al01.acs.local systemd[1]: Started VMware ALP Management Service.

7. Diagnose deployment errors by running the /opt/vmware/alp/bin/diagnose executable file.

The diagnose tool verifies that the services are up and running and that all configuration
requirements are met.

[[email protected] ~]# /opt/vmware/alp/bin/diagnose

Step 1: System diagnose
--------------------------------------------------------------------------------
- App Launchpad service is initialized.


Step 2: Cloud Director diagnose
--------------------------------------------------------------------------------
- Service Account for App Launchpad is good.
- App Launchpad's extension is ready.


Step 3: MQTT diagnose
--------------------------------------------------------------------------------
- Cloud Director MQTT for extensibility is ready.


Step 4: Integration diagnose
--------------------------------------------------------------------------------
- App Launchpad API is up, and version is 2.1.0-18834930.


Step 5: App Launchpad diagnose
--------------------------------------------------------------------------------
- App Launchpad service is listening on port 8086.


8. Confirm the ALP version.

[[email protected] ~]# alp
NAME:
        alp - The Cloud Director App Launchpad
        (ALP) Command-line tool

USAGE:
        alp <subcommand> [flags]

VERSION:
        '2.1.0-18834930'

Upgrade vRealize Operations Management Pack for vCloud Director from 5.5 to 8.6

I’ve recently upgraded vRealize operations Manager from 8.4 to 8.6. The installed version of vROPs Management Pack for VCD was 5.5, which is incompatible with vROps 8.6 and VMware Cloud Director 10.3.1. To make it compatible I had to upgrade vROps Management Pack for VCD to 8.6.


Please find the steps below to upgrade the Management Pack.

  1. Download the following vRealize Operations Management Pack for vCloud Director 8.6 from VMware Marketplace.
    • vmware-vcd-mp-8-1634219770748.pak
  2. Once downloaded, login to vRealize Operations Manager 8.6 UI – https://<vROps FQDN/IP>/ui
  3. Navigate to Data Sources > Integrations > Repository.
  4. From ‘Installed Integrations‘ locate ‘Management Pack for VMware Cloud Director.

5. Click on More Options menu and select Upgrade.

5. Select the Install the PAK file even if it is already installed check box.

This selection reloads the PAK file (Management Pack) but retains the custom preferences of the user. Also, this selection does not overwrite or update the solution alerts, symptoms, recommendations, and policies.

6. Select the Reset Default Content, overwriting to a newer version provided by this update check box.

This selection reloads the PAK file and overwrites the existing solution alerts, symptoms, recommendations, and policies with newer versions provided with the current PAK file.

WARNING: User modifications to DEFAULT Alert Definitions, Symptoms, Recommendations, Policy Definitions, Views, Dashboards, Widgets and Reports supplied by the current version of Management Pack will be overwritten. To save your modifications to default content, clone or backup the content before you proceed.

7. Click on Upload.

8. Click Next.
9. Read and accept the EULA and click Next. The install might take several minutes to complete.
10. Click Finish once the installation is completed.

11. Confirm the Upgrade is completed by checking the version of Management Pack. ‘More Options‘ > About.

12. Check and confirm the ‘Cloud Director Adapter‘ is collecting the data from VCD. The status of Cloud Director Adapter should be OK.

  • Navigate to Data Sources > Integrations > Accounts > Cloud Director Adapter.

How to create AWS Lambda function with PowerCLI to access VMConAWS?

AWS Lambda in a nutshell

Lambda is an AWS offering to build serverless applications. It helps you to run code without provisioning or managing servers. The Lambda functions can be invoked directly through API calls or in response to events. AWS will charge the customer only for the compute time consumed by Lambda function, so no need to pay for idle time. You can learn more about lambda here.

AWS Lambda, PowerShell and PowerCLI

The code you run on AWS Lambda is uploaded as a ‘Lambda Function’. AWS Lambda natively supports PowerShell as scripting language. It helps us to write Lambda functions in PowerShell which includes commands from PowerCLI modules.

Let us see the steps to create a PowerShell based Lambda Function to get the list of VMs from a VMware Cloud on AWS SDDC. As of now the AWS Code Editor doesn’t support writing or editing PowerShell based Lambda functions. The steps discuss how to create the Lambda functions offline and deploy them in AWS Lambda.

Step 1 : Install PowerShell Core.

The Lambda functions in PowerShell require PowerShell Core 6.0, Windows PowerShell isn’t supported. If you have PowerShell Core 6.0 or above already installed, skip to step 2. The environment variable $PSVersionTable will help you to find the PowerShell version and Edition.

I’ve used Powershell Core v6.2.1 which can be downloaded from PowerShell GitHub repo.

1.1 Goto https://github.com/PowerShell/PowerShell/releases/tag/v6.2.1 > Assets > and download the Package suitable for your OS, mine is Windows 10 and the bundle ‘PowerShell-6.2.1-win-x64.msi’ worked fine.

1.2 Once downloaded, double-click the installer and follow the prompts.

Step 2 : Install .NET Core 2.1 SDK.

Because PowerShell Core is built on top of .NET Core, the Lambda support for PowerShell uses the same .NET Core 2.1 runtime for both .NET Core and PowerShell Lambda functions. The .NET Core 2.1 SDK is used by the Lambda PowerShell publishing cmdlets to create the Lambda deployment package. The .NET Core 2.1 SDK is available at .NET downloads on the Microsoft website. Be sure to install the SDK and not the runtime installation.

Step 3 : Install Powershell module ‘AWSLambdaPSCore’

Open PowerShell Core and run the following command to install ‘AWSLambdaPSCore’ module.

Install-Module AWSLambdaPSCore -Scope CurrentUser

The following are the commands available in module ‘AWSLambdaPSCore’

Step 4 : Install PowerCLI

If you already have PowerCLI modules installed in Powershell Core, skip this step.

Open PowerShell Core and run the following command

Install-Module VMware.PowerCLI

Step 5 : Create script from PowerShell Lambda Templates.

AWSLambdaPSCore module provides some Script Templates. Get-AWSPowerShellLambdaTemplate will list out the available templates.

We will use the template ‘Basic’ to create script ‘VMC-GetVM.ps1’ for getting the VM list from VMC SDDC.

Step 6 : Modify the script to get the VMs from vCenter located VMConAWS SDDC.

If you are new to Powershell Lambda its good to go through this articleto understand Input Object, Returning Data, Additional Modules and Logging.

Open the script VMC-GetVM.ps1 in the editor, I use VSCode. Replace the content of the script with the following script.

Note: Please ensure the version of modules marked with #Requiresstatement are same as the version of modules loaded in Powershell Core. If it’s different, then update the script with version details of corresponding modules which are loaded. The following command will help to find the versions of required modules.

Get-InstalledModule VMware.*.Sdk,VMware.*.common,VMware.vim,VMware.*.Cis.Core,VMware.*.core | select Name,Version

The values for the properties (venter, vCenterUser, etc) in the object $LamdaInput will be passed when we execute the function.

# PowerShell script file to be executed as a AWS Lambda function. 
# 
# When executing in Lambda the following variables will be predefined.
#   $LambdaInput - A PSObject that contains the Lambda function input data.
#   $LambdaContext - An Amazon.Lambda.Core.ILambdaContext object that contains information about the currently running Lambda environment.
#
# The last item in the PowerShell pipeline will be returned as the result of the Lambda function.
#
# To include PowerShell modules with your Lambda function, like the AWSPowerShell.NetCore module, add a "#Requires" statement 
# indicating the module and version.
#Requires -Modules @{ModuleName='VMware.VimAutomation.Sdk';ModuleVersion='11.3.0.13964823'}
#Requires -Modules @{ModuleName='VMware.VimAutomation.Common';ModuleVersion='11.3.0.13964816'}
#Requires -Modules @{ModuleName='VMware.Vim';ModuleVersion='6.7.0.13964812'}
#Requires -Modules @{ModuleName='VMware.VimAutomation.Cis.Core';ModuleVersion='11.3.0.13964830'}
#Requires -Modules @{ModuleName='VMware.VimAutomation.Core';ModuleVersion='11.3.0.13964826'}

# Uncomment to send the input event to CloudWatch Logs
#Write-Host (ConvertTo-Json -InputObject $LambdaInput -Compress -Depth 5)

$vCenter = $lambdainput.vCenter
$vCenterUser = $lambdainput.vCenterUser
$vCenterPassword = $lambdainput.vCenterpassword
Connect-VIServer $vCenter -User $vCenterUser -Password $vCenterPassword
$vmlist = get-vm
Write-Host $vmlist.Name

Save the script.

Step 7 : Reduce the size of package

In next step we will publish the Lambda Function. While publishing, a deployment package that contains our PowerShell script ‘VMC-GetVM.ps1’ and all modules declared with the #Requires statement will be created. But the deployment may fail since the package with listed PowerCLI modules will exceed Lambda’s hard limit on Package size, ie 69905067 bytes. In that situation the following error will be thrown.

To avoid that, as a workaround, we’ve to reduce the package size by cutting down the size of PowerCLI modules. When I checked ‘VMware.VimAutomation.Core’ is the largest module which is due to  Remote Console files included in the module.

Browse to the following path and move the folder ‘VMware Remote Console’ to Documents.

C:\Users\<user>\Documents\PowerShell\Modules\VMware.VimAutomation.Core\11.3.0.13964826\net45

Step 8 : Create IAM role to access CloudWatch Log and to execute Lambda.

Login to AWS Console and navigated to IAM. Create new role ‘lambda_basic_excution’ with the policy ‘CloudWatchLogsFullAccess’.

Step 9 : Publish to Lambda

To publish our new PowerShell based Lambda function, let’s execute the following command from Powershell Core.

Publish-AWSPowerShellLambda -ScriptPath <path>\VMC-GetVM.ps1 -Name RDPLockDown -Region <aws region> -IAMRoleArn lambda_basic_excution

It will take a while to create the package and deploy to AWS Lambda.

Step 10 : Configure environment variable.

Once the function is deployed, login to AWS Console and navigate to Lambda. Select the newly created function ‘VMC-GetVM’

Set the environment variable HOME to /tmp.

Step 11 : Install AWSPowerShell module.

To execute the newly created function from PowerShell Core we need the module ‘AWSPowerShell’. Run the following command to install it.

Install-Module AWSPowerShell

Step 12 : Execute the function

From the editor (VSCode) create new file LambdaExecute.ps1 and copy the following code.

$payload = @{    vCenter =  '<FQDN of vCenter in VMConAWS>'    vCenterUser = '<vCenter User>'    vCenterpassword = '<vCenter Password>'} | convertto-json Invoke-LMFunction -FunctionName VMC-GetVM  -Payload $payload

Once the execution completed you can see the list of VMs in CloudWatch Logs.

From AWS Console go to CloudWatch > Log Groups and select ‘ /aws/lambda/VMC-GetVM’ and click on latest log stream.

You can see the VMs list in the Message!

Powercli to create report with VM Tag, Category, Tools version and VM HW Version

Recently one of the community members had a requirement to generate report with the following details in .csv format.

– VM Name
– VMware Tools Version
– VM Hardware Version
– Category Names as columns and Tag names as values.

The following PowerCLI script will help to achieve this.

<# .SYNOPSIS Create .csv report with Virtual Machine Tag, Category, VMware tools version and VM Hardware details. .NOTES Author: Sreejesh Damodaran Site: www.pingforinfo.com .EXAMPLE PS> get-vmtagandcatefory.ps1

#>

# Connect to the vCenter
Connect-VIServer vCenter1 -user user1 -Password "password"

#Create vmInfo object
$vmInfo = @()
$vmInfoTemp = New-Object "PSCustomObject"
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name VMName -Value ""
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name ToolsVersion -Value ""
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name HWVersion -Value ""
$vmCategories = Get-TagCategory
$vmCategories | %{$vmInfoTemp | Add-Member -MemberType NoteProperty -Name $_.Name -Value "" }
$vmInfo += $vmInfoTemp

get-vm | %{
$vmInfoTemp = New-Object "PSCustomObject"
$toolsVersion = Get-VMGuest $_ | select -ExpandProperty ToolsVersion
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name VMName -Value $_.Name
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name ToolsVersion -Value $toolsVersion
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name HWVersion -Value $_.Version
$vmtags = ""
$vmtags = Get-TagAssignment -Entity $_
if($vmtags){
$vmCategories | %{
$tempVMtag = ""
$tempCategroy = $_.Name
$tempVMtag = $vmtags | Where-Object {$_.tag.category.name -match $tempCategroy}
if($tempVMtag)
{
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name $tempCategroy -Value $tempVMtag.tag.name
}else {
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name $tempCategroy -Value ""
}
}
}else{
$vmCategories | %{
$vmInfoTemp | Add-Member -MemberType NoteProperty -Name $_.name -Value ""
}
}
$vmInfo += $vmInfoTemp
}

$vmInfo | select * -Skip 1 | Export-Csv c:\temp\tags.csv -NoTypeInformation -UseCulture

CSV Output:

PowerCLI to find vCPU to pCPU ratio and vRAM to pRAM ratio

vsphere-PowerCLI
 
 
I was in search for a script to generate report on vCPU to pCPU ratio and vRAM to pRAM at cluster level in a vCenter. Found couple of interesting community threads which address part of the requirements. Thought to consolidate (or extract:) ) the code and created the following. The report will be generated as CSV file.

[crayon lang=”powershell”]

 

$outputFile = “C:\CPU-Memory-Ratio.csv”
$VC = “vCenter Name”

##Connect to the vCenter
Connect-VIServer $VC -User “test” -Password “test”

$Output [email protected]()

Get-Cluster | %{
$hypCluster = $_

## get the GenericMeasureInfo for the desired properties for this cluster’s hosts
$infoCPUMEM = Get-View -ViewType HostSystem -Property Hardware.CpuInfo,Hardware.memorysize -SearchRoot $hypCluster.Id |
Select @{n=”NumCpuSockets”; e={$_.Hardware.CpuInfo.NumCpuPackages}}, @{n=”NumCpuCores”; e={$_.Hardware.CpuInfo.NumCpuCores}}, @{n=”NumCpuThreads”; e={$_.Hardware.CpuInfo.NumCpuThreads}},@{n=”PhysicalMem”; E={“”+[math]::round($_.Hardware.MemorySize / 1GB, 0)}} |
Measure-Object -Sum NumCpuSockets,NumCpuCores,NumCpuThreads,PhysicalMem

## return an object with info about VMHosts’ CPU characteristics

$temp= New-Object psobject
$datacenter = Get-Datacenter -Cluster $hypCluster.Name
$NumVMHosts = if ($infoCPUMEM) {$infoCPUMEM[0].Count} else {0}
$NumCpuSockets = ($infoCPUMEM | ?{$_.Property -eq “NumCpuSockets”}).Sum
$NumCpuCores = ($infoCPUMEM | ?{$_.Property -eq “NumCpuCores”}).Sum
$vmdetails = Get-VM -Location $hypCluster
$NumvCPU = ( $vmdetails | Measure-Object NumCpu -Sum).Sum
$VirtualMem= [Math]::Round(($vmdetails | Measure-Object MemoryGB -Sum).Sum, 2)
$PhysicalMem = ($infoCPUMEM | ?{$_.Property -eq “PhysicalMem”}).Sum

##Calculating the vCPU to pCPU ratio AND vRAM to pRAM ratio.

if ($NumvCPU -ne “0”) {$cpuRatio= “$(“{0:N2}” -f ($NumvCPU/$NumCpuCores))” + “:1”}
if ($VirtualMem -ne “0”) {$memRatio= “$(“{0:N2}” -f ($VirtualMem/$PhysicalMem))” + “:1”}

$temp | Add-Member -MemberType Noteproperty “Datacenter” -Value $datacenter
$temp | Add-Member -MemberType Noteproperty “ClusterName” -Value $hypCluster.Name
$temp | Add-Member -MemberType Noteproperty “NumVMHosts” -Value $NumVMHosts
$temp | Add-Member -MemberType Noteproperty “NumPCPUSockets” -Value $NumCpuSockets
$temp | Add-Member -MemberType Noteproperty “NumPCPUCores” -Value $NumCpuCores
$temp | Add-Member -MemberType Noteproperty “NumvCPU” -Value $NumvCPU
$temp | Add-Member -MemberType Noteproperty “vCPU-pCPUCoreRatio” -Value $cpuRatio
$temp | Add-Member -MemberType Noteproperty “PhysicalMem(GB)” -Value $PhysicalMem
$temp | Add-Member -MemberType Noteproperty “VirtualMem(GB)” -Value $VirtualMem
$temp | Add-Member -MemberType Noteproperty “vRAM-pRAMRatio” -Value $memRatio

$Output+=$temp

}
$Output | Sort-Object Account | Export-Csv -NoTypeInformation $outputFile

[/crayon]

Output in table format :

[table id=4 /]

Ref : https://communities.vmware.com/thread/456555?start=0&tstart=0

 

VMware vCloud : This VM has a compliance failure against its Storage Policy.

vCloud PowerCLI

 

 

 

Issue :

VMs in vCloud Director displays the message : “System alert – This VM has a compliance failure against its Storage Policy.”

Symptoms :

After changing the storage profile of the VM you may observe the following error in ‘Status‘.

“System alerts – This VM has a compliance failure against its Storage Policy.”

Virtual Machine <VMName>(UUID) is NOT_COMPLIANT against Storage Policy <SP Name> as of 6/18/16 11:04 AM
Failures are:
The disk [0:0] of VM <VMName>(UUID) is on a datastore that does not support the capabilities of the disk StorageProfile <SP Name>

Resolution :

To reset the alarm in the vCloud Director.

Option 1:

  1. Click the System Alert and select ClearAll.

vcd-1

 

 

 

 

vcd-2

 

 

 

 

 

 

Option 2:

If many VMs have the same alerts then its difficult to clear one by one. In that case we can use SQL statement to clear all alerts.

  1. Log in to the database with Admin credentials using Microsoft SQL Management Studio.
  2. Run this SQL statement to display all virtual machines with the system alert:
    #
    select * from object_condition where condition = 'vmStorageProfileComplianceFailed'
    #

    vcd-3

  3. Run this update statement to clear the alert in the vCD UI:
    #
    update object_condition set ignore = 1 where condition = 'vmStorageProfileComplianceFailed'
    #

 

PowerCLI to deploy VMs in VMware vCloud and connect to network

vCloud PowerCLI

This PowerCLI script will help you to deploy VMs in VMware Private vCloud and connect to network.

 
 
#############################
# Deploy VMs in  vCloud     #
#############################
# Change Log
# 1.0 This script will Create vApp and deploy VMs from the selected TemplateVM.
 
################
# INITIALIZING #
################
 
### DECLARING VARIABLES ###
 
$vCloud_Server = "vCloud Server" # vCloud Server FQDN
$vCloud_Org    =    "Org Name"   # Org Name
$orgNetwork = "orgNwName"        # Target OrgNetworkName for the VM.
$templateVM = "TemplateVMName    # Template VM Name.
$vmCount = 2                     # No of VMs required.
$vmIndex = 4                     # VM starting index.
$vAppNamePrefix =  "RHEL-vApp"   # Prefix string in the vApp Name.
$VMNamePrefix = "RHEL-VM"        # Prefix string in the VM Name.
 
### Connect to the vCloud Server ###
Connect-CIServer $vCloud_Server
 
### Deploying VMs ###
$vmCount = $vmIndex + $vmCount
 
for($i=$vmIndex; $i -le $vmCount; $i++)
{
$vAppName = $vAppNamePrefix+"$i"
$VMName = $VMNamePrefix+"$i"
 
### Creating new vApp ###
New-CIVApp -Name $vAppName -OrgVdc $vCloud_Org
 
### Deploy the VM from template inside the newly created vApp###
New-CIVM -Name "$VMName" -VMTemplate $templateVM -VApp $vAppName -ComputerName "$VMName"
 
### Creating new vApp Network ###
New-CIVAppNetwork -VApp $vAppName -Direct -ParentOrgNetwork $orgNetwork
 
$vAppNetwork = get-civapp $vAppName | Get-CIVAppNetwork $orgNetwork
$cldVMs = get-civapp $vAppName | get-civm
 
### Connecting the vNIC to the network ###
### Please change the allocation model if required###
foreach ($cldvm in $cldVMs) {
    $cldvm | Get-CINetworkAdapter | Set-CINetworkAdapter -vappnetwork $vAppNetwork -IPaddressAllocationMode Pool -Connected $True
}
### Powering on the vApp ###
get-CIVApp -Name $vAppName | Start-CIVApp
}
 
Disconnect-CIServer $vCloud_Server -Force -Confirm:$false