I was trying to register vRealize Orchestrator with vCloud Director 9.5. The steps are documented here. But I had few issues while registering vRO. I thought the steps with screenshot may be useful for you. Please find the steps with screenshots below. Continue reading
vCD : Change SSH Session Idle timeout of vCloud Director Appliance.
Its bit annoying that the SSH connection to vCloud DIrector Appliance get cut off for just idling for a short time. So we may want to tweak the ssh configuration of vCD appliance to keep the connection alive for longer period.
The following two properties of SSHD define how long the SSH session should stay though there is no input received from the client.
ClientAliveCountMax
ClientAliveInterval
Please click here fore more details.
ClientAliveCountMax
Sets the number of client alive messages which may be sent without sshd(8) receiving any messages back from the client. If this threshold is reached while client alive messages are being sent, sshd will disconnect the client, terminating the session. It is important to note that the use of client alive messages is very different from TCPKeepAlive. The client alive messages are sent through the encrypted channel and therefore will not be spoofable. The TCP keepalive option enabled by TCPKeepAlive is spoofable. The client alive mechanism is valuable when the client or server depend on knowing when a connection has become inactive.
The default value is 3.
If ClientAliveInterval is set to 15, and ClientAliveCountMax is left at the default, unresponsive SSH clients will be disconnected after approximately 45 seconds.
ClientAliveInterval
Sets a timeout interval in seconds after which if no data has been received from the client, sshd(8) will send a message through the encrypted channel to request a response from the client. The default is 0, indicating that these messages will not be sent to the client.
Change Hostname of vCloud Director Appliance
Hey All, hope you all doing well.
At the moment when you deploy VCD appliance we dont have the option to provide the hostname for the vCloud Director Cell . When you login to the console or ssh to the appliance, it just shows the default ‘photon-machine’ as the hostname. Its difficult to identify the VCD Cells if you have multiple cells in the environment.
Changing Hostname of the appliance is easy. Here is your warning. I would not recommend using this workaround in your production environment without being directed to make this change by VMware support or officially documented by VMware.
Please find the steps below. Continue reading
vCloud Director 9 HTML5 Tenant portal is blank.
VMware vCloud : This VM has a compliance failure against its Storage Policy.
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:
- Click the System Alert and select ClearAll.
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.
- Log in to the database with Admin credentials using Microsoft SQL Management Studio.
- Run this SQL statement to display all virtual machines with the system alert:
123#select * from object_condition where condition = 'vmStorageProfileComplianceFailed'#
- Run this update statement to clear the alert in the vCD UI:
123#update object_condition set ignore = 1 where condition = 'vmStorageProfileComplianceFailed'#
PowerCLI script to Set Perennial reservation on RDM LUNs in a Cluster
Please find the Powercli script for configuring Perennial reservation on all RDM luns in a ESXi Cluster. Please change the value for following variables before you execute the script.
$vcenter = “vCenter.vmtest.com”
$dCenter = “123456”
$cluster = “Production Hypervisor”
This is the flow of script execution.
1. Get the list of RDM LUNs from the cluster.
2. Check the current perennial reservation status of the RDM. If it’s TRUE, no changes will be applied.
3. If the status is FALSE, the perennial reservation will be set on the LUN.
4. Script will query the latest status and the status will be displayed.
The result, after executing the script, looks something like this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# This script will set the parameter Perennially Reservations to True on RDM Luns in a cluster #$vcenter = #"vCenter Name " #$dCenter = #"Datacenter Name" #$cluster = #"Cluster Name" $vcenter = "vCenter.vmtest.com" $dCenter = "123456" $cluster = "Production Hypervisor" #------------------------------------------------------------------------- # Do not modify bellow script #------------------------------------------------------------------------- #Add-PSSnapIn VMware* -ErrorAction SilentlyContinue $connected = Connect-VIServer -Server $vcenter | Out-Null $clusterInfo = Get-Datacenter -Name $dCenter | get-cluster $cluster $vmHosts = $clusterInfo | get-vmhost | select -ExpandProperty Name $RDMNAAs = $clusterInfo | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select -ExpandProperty ScsiCanonicalName -Unique foreach ($vmhost in $vmHosts) { $myesxcli = Get-EsxCli -VMHost $vmhost foreach ($naa in $RDMNAAs) { $diskinfo = $myesxcli.storage.core.device.list("$naa") | Select -ExpandProperty IsPerenniallyReserved $vmhost + " " + $naa + " " + "IsPerenniallyReserved= " + $diskinfo if($diskinfo -eq "false") { write-host "Configuring Perennial Reservation for LUN $naa......." $myesxcli.storage.core.device.setconfig($false,$naa,$true) $diskinfo = $myesxcli.storage.core.device.list("$naa") | Select -ExpandProperty IsPerenniallyReserved $vmhost + " " + $naa + " " + "IsPerenniallyReserved= " + $diskinfo } write-host "----------------------------------------------------------------------------------------------" } } Disconnect-VIServer $vcenter -confirm:$false | Out-Null |
-SD
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
<# .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:
-SD
Powershell oneliner to find the VMware softwares installed, version and installDate.
PowerCLI to find vCPU to pCPU ratio and vRAM to pRAM ratio
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
$outputFile = "C:\CPU-Memory-Ratio.csv" $VC = "vCenter Name" ##Connect to the vCenter Connect-VIServer $VC -User "test" -Password "test" $Output =@() 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 |
Output in table format :
Datacenter | ClusterName | vCPU-pCPUCoreRatio | vRAM-pRAMRatio | NumVMHosts | NumPCPUSockets | NumPCPUCores | NumvCPU | PhysicalMem(GB) | VirtualMem(GB) |
---|---|---|---|---|---|---|---|---|---|
12345 | 12345-HypClus1 | 1.85:1 | 0.28:1 | 3 | 6 | 48 | 89 | 768 | 214 |
678910 | 678910-HypClus2 | 0.60:1 | 0.21:1 | 5 | 20 | 160 | 96 | 640 | 132 |
12345 | 12345-HypClus2 | 2.08:1 | 0.91:1 | 2 | 2 | 12 | 25 | 64 | 58 |
Ref : https://communities.vmware.com/thread/456555?start=0&tstart=0
PowerCLI to deploy VMs in VMware vCloud and connect to network
This PowerCLI script will help you to deploy VMs in VMware Private vCloud and connect to network.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
############################# # 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 |