How to work with vCenter 6.5 internal database

vCenter 6.5 we are using postgress database as internal database for vCenter.All the information related to vCenter are store in this database.

How to access data in this database Continue reading

Advertisements

How to use hash table with Powercli

Tags

,

Hash table is a data structure where we can store our data.Comparing to the data arrays in powercli/powershell , the main difference is with hash table we can easily handle multiple type of data such as Integer,String,etc..

Some times we need to generate reports using some of the PowerShell commands(export-csv,out-file,add-content).With below example my requirement is to generate vm report which include VMname,Datastore name,Network port group and vmawre tools status.But to gather all the information we have to use multiple get commands and then its difficult to consolidate this data.Hash table was helped me on this.I can gather values from multiple commands and assign to hash table.I have highlghted hash table related commands in my script.

import-module vmware.vimautomation.ha

connect-viserver vcsa.corp.local
$vms=get-vm

$result=@()

foreach ($vm in $vms)

    {
     $vmname=$vm.name
     $dstore=get-vm $vm.name|get-datastore
     $nicport=(get-vm $vm.name).extensiondata.network.value
     $vmtools=(get-vm $vm.name).extensiondata.guest.toolsstatus
     $properties=@{
     name=$vmname
     datastore=$dstore
     network-$nicport
     vmwaretools=$vmtools

     }

$result+=new-object psobject -property $properties
$result|select name,datastore,network,vmwaretools|export-csv d:\mycsv.csv -append -notypeinformation

Multiple vCenters-how to avoid duplicate MAC address of virtual machines

If we have multiple vCenters in virtualization environment , there would be a possibility of issuing same MAC address to different virtual machines from different vCenter servers.

How we can avoid this kind of issue?

When we are installing vCenters it will automatically generate instance id for vCenter.We can check th vCenter servers ID from web client.

image

If multiple vCenter servers use same Instance ID , there will be a possibility of having MAC duplication problem. In this case we can change one of vCneter servers Instance ID from web client.

image