Search This Blog

Monday, 14 June 2021

esxcli2 vSAN commands


 Connect-viserver

$vmhost = esxiHostName

$esxcli = get-esxcli -v2 -vmhost $vmhost

$esxcli.vmhost.name

$esxcli.vmhost.connectionstate

$esxcli.vsan.debug.object.health.summary.get.invoke()

$esxcli.vsan.debug.resync.summary.get.invoke()

$esxcli.vsan.health.cluster.list.invoke() | sort-object -property status -Descending


#T get Cluster info 

$esxcli.vsan.cluster.get.invoke()

#To get core disk info 

$esxcli.storage.core.path.list.invoke()

#To get adapter info 

$esxcli.storage.core.adapter.list.invoke()

#To get vSAN disks list

$esxcli.vsan.storage.list.invoke()

$esxcli.vsan.debug.controller.list.invoke()

#To remove disk group 

$diskuuid = 'Provide disk group UUID'

$removeDG = $esxcli.vsan.storage.remove.CreateArgs()

$removeDG.uuid= "$diskuuid"

$esxcli.vsan.storage.remove.invoke($removeDG)

# To get Object information with uuid or vmname

$OBJuuid = 'Provide the object UUID'

$vmname = 'Provide the vmname'

$objlookarg = $esxcli.vsan.debug.object.list.CreateArgs()

$objlookarg.uuid = "$OBJuuid"

$objlookarg.vmname = "$vmname"

$esxcli.vsan.debug.object.list.invoke($objlookarg)

$esxcli.vsan.debug.object.list.invoke($objlookarg) | select objectUUID,Size,Health,Owner,Path

# To get physical disk location 

$inputdevide = 'mpx.vmba0:C2:T0:L0 - like this'

$cd = $esxcli.storage.core.device.physical.get.CreateArgs()

$cd.device = "$inputdevide"

$d = $esxcli.storage.core.device.phycial.get.Invoke($cd)

$d

#To convert value from Hexa to Decimal

[Convert]::ToInt64("B0",16)

# Power Policy settings

esxcli hardware power policy choices list
esxcli hardware power policy get
esxcli hardware power policy set --short-name static

# Nerwork load balance

esxcli network nic queue
loadbalancer plugin list

esxcli vsan debug evacuation precheck -a noAction -e localhost
$esxcli.network.nic.list.Invoke()
$esxcli.network.nic.down.invoke(@{nicname="vmnic1"})
$esxcli.network.nic.up.invoke(@{nicname="vmnic1"})
# VM process kill 
$esxcli.vm.process.kill.CreateArgs()
esxcli.vm.process.kill.Help()
$esxcli.vm.process.kill.Invoke(@{type = 'hard'; worldid = '2251094'})
$esxcli.vm.process.list.Invoke()


# Esxi user account password reset
<########
$esxcli = Get-EsxCli -VMhost esx5.virten.lab -V2
$arguments = $esxcli.system.account.set.CreateArgs()
$arguments.id = 'admin'
$arguments.password = '4!XdfF$$s'
$arguments.passwordconfirmation = '4!XdfF$$s'
$arguments

$esxcli.system.account.set.Invoke($arguments)
#######>
#Storage
$esxcli.iscsi.adapter.param.get.Invoke(@{adapter = 'vmhba64'})
esxcfg-vmknic -l
esxcli vsan network list
less -i var/run/log/vodb.log
localcli vsan health cluster list
localcli vsan health cluster get - t "vSAN cluster partition"
localcli vsan cluster unicastagent list 



Ansible_Notes

   ansible -i inventory.ini -m ping all   # inventory.ini it will ping to the hosts which are in inventory # ansible -i inventory.ini -m pin...