Powershell Cmdlets | Nutanix Community
Skip to main content

Hi Guys - Looking for some info with the powershell cmdlets

I am writing a powershell script to list out all the ahv host name and ip address| cvm  name and ip address impi host name| ip address in a cluster

What is the command to get the cvm name and their ip address in a cluster.

I am not quiet sure about “Cluster Type and Region when I issue  Get-NTNXCloudCvm command… Any help would be much appreciated!

 

Thanks,

Mahendra.

Hi Mahendra,

 

The Get-NTNXCloudCvm is only for CVMs that are in public clouds, such as, for example, AWS for DR solutions. It is not the command that you need.

Here is what can help you:

Get-NTNXHost | ft name,serviceVMExternalIP,hypervisorAddress,ipmiAddress

You can get CVM names by doing this:

Get-NTNXVM -SearchString "VM is a Nutanix CVM" | ft vmname,ipAddresses

 


Thank you @Sergei Ivanov for the quick response. I got it right. However, I am trying to run the .csv report by collecting all these information in a single csv file and below is script I am using for that  but however I am not right output . Nut sure what I am missing here?

I am getting the output only for $NTNXHost and not getting any info for $NTNXVM.

$report = @()
$NTNXHost = Get-NTNXHost | Select-Object name,serviceVMExternalIP,hypervisorAddress,hypervisorUsername,ipmiAddress,ipmiUsername,serial,blockModelName
$report+=$NTNXHost
$report += "`r`n"
$NTNXClusterInfo = Get-NTNXClusterInfo | Select-Object name,clusterExternalIPAddress
$report+=$NTNXClusterInfo
$report += "`r`n"
$NTNXVM  = Get-NTNXVM -SearchString "VM is a Nutanix CVM" | ft vmname,ipAddresses
$report+=$NTNXVM 
$report | Export-Csv -Path testreport.csv -NoTypeInformation -UseCulture