Exporting Nutanix Servers to CSV
When running a Nutanix scan in DMC, you must provide a list of servers (VMs) that DMC will connect to.
Unlike VMware (vCenter integration), DMC cannot directly enumerate Nutanix Prism or AHV clusters.
Instead, you must generate a CSV of IPs/FQDNs + OS type for bulk import.
This guide provides PowerShell helper scripts (using the Nutanix PowerShell module) to export Nutanix VMs into a DMC-ready CSV file.
Why this is needed¶
- DMC has no native Nutanix Prism integration today.
- You must supply VM endpoints explicitly.
- The CSV export makes it easy to bulk load these into DMC.
Requirements¶
Before running the export script, ensure you have the following:
Nutanix Access - Prism Central or Prism Element credentials with VM enumeration permissions - Network connectivity to the Prism management interface - Valid username/password for API access
PowerShell Environment - PowerShell 5.1 or later (PowerShell 7+ recommended) - Execution policy allowing script execution (RemoteSigned, Unrestricted, or Bypass) - Internet access for automatic module installation (or manual MSI installation) - Write access to the output directory for CSV export
Required PowerShell Modules - Nutanix.Cli module (automatically installed if missing) - NuGet package provider (automatically configured) - PowerShell Gallery access (for module installation)
Note: The script automatically handles module installation. If you're in a restricted environment, you can manually install the Nutanix.Cli module from the MSI available in Prism Central's Downloads section.
CSV format required by DMC¶
Host,Os
fqdn-or-ip,windows|linux|unknown
- Host: FQDN or IP address of the VM
- Os:
windows,linux, orunknown
DMC will validate the OS type during the Validate Servers step.
The script provided in this guide is supplied as-is, without any warranties or guarantees.
You should validate and test the script in your own environment before running it in production or on critical systems.
Export Nutanix Guest VMs¶
This script connects to Prism Central (or Prism Element) and exports VM IPs or FQDNs into the format required by DMC.
<#
.SYNOPSIS
Export Nutanix VMs to a DMC-ready CSV (Host,Os) with module preflight checks.
REQUIREMENTS:
- PowerShell 5.1+ (PowerShell 7+ recommended)
- Prism Central/Element credentials with VM enumeration permissions
- Network connectivity to Prism management interface
- Internet access for automatic module installation (or manual MSI installation)
- Write access to output directory for CSV export
.DESCRIPTION
- Ensures required modules are present (Nutanix.Cli).
- Connects to Prism Central/Element and enumerates VMs.
- Exports Host (FQDN or IP) and Os (windows|linux|unknown) as DMC expects.
.PARAMETER PrismServer
Prism Central/Element FQDN or IP.
.PARAMETER Username
Prism API username.
.PARAMETER Password
Prism API password (plain string). For interactive prompt, omit and it will call Get-Credential.
.PARAMETER OutputPath
Path to save CSV file. Defaults to .\nutanix_dmc_ready.csv
.PARAMETER DefaultOS
Optional override for OS column. Accepts 'Windows' or 'Linux'. Defaults to 'unknown'.
.PARAMETER PrismElement
Switch: connect to Prism Element instead of Prism Central.
.EXAMPLE
.\Export-NutanixVMs.ps1 -PrismServer prism.example.com -Username admin -Password 'MyPass' -DefaultOS Windows
#>
[CmdletBinding()]
param(
[Parameter(Mandatory)] [string] $PrismServer,
[Parameter(Mandatory)] [string] $Username,
[Parameter()] [string] $Password,
[Parameter()] [string] $OutputPath = ".\nutanix_dmc_ready.csv",
[Parameter()] [ValidateSet('Windows','Linux')] [string] $DefaultOS,
[Parameter()] [switch] $PrismElement
)
# -----------------------------
# Preflight: Environment checks
# -----------------------------
# Enforce TLS 1.2 for gallery downloads (older hosts)
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {}
function Write-Info { param([string]$m) Write-Host "[INFO] $m" -ForegroundColor Cyan }
function Write-Warn { param([string]$m) Write-Host "[WARN] $m" -ForegroundColor Yellow }
function Write-Err { param([string]$m) Write-Host "[ERROR] $m" -ForegroundColor Red }
# Minimal PS version (5.1+ or PowerShell 7+ recommended)
$psVerOk = ($PSVersionTable.PSVersion.Major -ge 5)
if (-not $psVerOk) {
Write-Err "PowerShell 5.1 or later required. Current: $($PSVersionTable.PSVersion)"
exit 1
}
# Ensure NuGet provider (for Install-Module), ignore errors on locked-down hosts
try {
if (-not (Get-PackageProvider -ListAvailable | Where-Object { $_.Name -eq 'NuGet' })) {
Write-Info "Installing NuGet package provider..."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser | Out-Null
}
} catch { Write-Warn "Could not ensure NuGet provider (offline/locked-down?). If module install fails, install Nutanix.Cli via Prism Central MSI." }
# Helper to ensure a module is available; installs to CurrentUser if missing.
function Ensure-Module {
param(
[Parameter(Mandatory)] [string] $Name,
[string] $MinVersion = "0.0.0"
)
$loaded = Get-Module -ListAvailable -Name $Name | Sort-Object Version -Descending | Select-Object -First 1
if ($loaded -and ($loaded.Version -ge [version]$MinVersion)) {
Write-Info "Module '$Name' found (v$($loaded.Version))."
return $true
}
Write-Info "Module '$Name' not found. Attempting install from PSGallery (CurrentUser)..."
try {
# Avoid prompts on first-time PSGallery use
if (-not (Get-PSRepository -Name 'PSGallery' -ErrorAction SilentlyContinue)) {
Register-PSRepository -Default -ErrorAction SilentlyContinue
}
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted -ErrorAction SilentlyContinue
Install-Module -Name $Name -Scope CurrentUser -Force -AllowClobber -ErrorAction Stop
Write-Info "Module '$Name' installed."
return $true
} catch {
Write-Warn "Failed to install '$Name' from PSGallery: $($_.Exception.Message)"
return $false
}
}
# -----------------------------
# Required modules
# -----------------------------
$okNutanix = Ensure-Module -Name "Nutanix.Cli"
if (-not $okNutanix) {
Write-Err @"
Nutanix.Cli is required but could not be installed automatically.
Options:
1) Install from PowerShell Gallery (if internet is allowed):
Install-Module Nutanix.Cli -Scope CurrentUser
2) Download the MSI from Prism Central (Downloads/Cmdlets) and install.
"@
exit 1
}
Import-Module Nutanix.Cli -ErrorAction Stop
# -----------------------------
# Connect to Prism
# -----------------------------
if (-not $Password) {
$cred = Get-Credential -UserName $Username -Message "Enter password for $Username"
$Password = $cred.GetNetworkCredential().Password
}
try {
if ($PrismElement) {
Write-Info "Connecting to Prism Element $PrismServer ..."
Connect-PrismElement -Server $PrismServer -UserName $Username -Password $Password -AcceptInvalidSSLCerts -ErrorAction Stop | Out-Null
} else {
Write-Info "Connecting to Prism Central $PrismServer ..."
Connect-PrismCentral -Server $PrismServer -UserName $Username -Password $Password -AcceptInvalidSSLCerts -ErrorAction Stop | Out-Null
}
} catch {
Write-Err "Failed to connect to Prism at '$PrismServer': $($_.Exception.Message)"
exit 1
}
# -----------------------------
# Normalize Default OS
# -----------------------------
$defaultOsCsv = if ($PSBoundParameters.ContainsKey('DefaultOS')) {
if ($DefaultOS -eq 'Windows') { 'windows' } else { 'linux' }
} else { 'unknown' }
Write-Info "Default Os value for CSV rows: '$defaultOsCsv'"
# -----------------------------
# Collect VMs -> DMC CSV rows
# -----------------------------
try {
$vms = Get-VM -ErrorAction Stop
} catch {
Write-Err "Get-VM failed: $($_.Exception.Message)"
exit 1
}
$rows = foreach ($vm in $vms) {
# NICS/IPs can be nested; handle missing lists safely
$nics = @()
if ($vm.PSObject.Properties.Match('nics').Count -gt 0 -and $vm.nics) {
$nics = $vm.nics
}
foreach ($nic in $nics) {
$ipList = @()
if ($nic.PSObject.Properties.Match('IpEndpointList').Count -gt 0 -and $nic.IpEndpointList) {
$ipList = $nic.IpEndpointList
}
foreach ($ip in $ipList) {
$addr = $ip.IP
if ([string]::IsNullOrWhiteSpace($addr)) { continue }
if ($addr -match '^169\.254\.') { continue } # skip APIPA
# Try to resolve FQDN; fall back to IP
$fqdn = $null
try { $fqdn = [System.Net.Dns]::GetHostEntry($addr).HostName } catch {}
[pscustomobject]@{
Host = if ($fqdn) { $fqdn } else { $addr }
Os = $defaultOsCsv
}
}
}
}
if (-not $rows -or $rows.Count -eq 0) {
Write-Warn "No IPs discovered from Prism. You may need guest tools/IP reporting enabled or DNS reachability."
}
# -----------------------------
# Write CSV
# -----------------------------
try {
$rows | Select-Object Host, Os | Export-Csv -Path $OutputPath -NoTypeInformation -Encoding UTF8
Write-Info "Export complete: $OutputPath"
Write-Info "Columns: Host,Os"
} catch {
Write-Err "Failed to write CSV to '$OutputPath': $($_.Exception.Message)"
exit 1
}
Examples¶
Basic Usage¶
Export from Prism Central with Os = unknown:
.\Export-NutanixVMs.ps1 -PrismServer prism.example.com -Username admin -Password (Get-Credential)
Default OS Assumption¶
Force Windows for all VMs:
.\Export-NutanixVMs.ps1 -PrismServer prism.example.com -Username admin -Password (Get-Credential) -DefaultOS Windows
Force Linux for all VMs:
.\Export-NutanixVMs.ps1 -PrismServer prism.example.com -Username admin -Password (Get-Credential) -DefaultOS Linux
Custom Output Path¶
.\Export-NutanixVMs.ps1 -PrismServer prism.example.com -Username admin -Password (Get-Credential) -OutputPath "C:\exports\nutanix_servers.csv"
Using the CSV in DMC¶
Open Server Selection¶
In Physical Scan, go to Server Selection.
Import CSV¶
Click Import CSV and choose the exported file.
Validate Connectivity¶
Validate servers to confirm connectivity (WinRM or SSH).
Run Scan¶
Proceed with Guest Credentials → Settings → Scan → Results.
Because Nutanix Prism doesn’t reliably expose guest OS, most entries will export with Os = unknown.
Use DMC’s Validate Servers step to confirm operating system type automatically.

