• ESXTOP
  • About
  • Guides
    • SQL Server 2016 Scripted Powershell Installation
    • Powershell Failover Cluster Install – SQL Server AAG or WSFC
    • AAG Add – Powershell
  • Travel Tips

Add Nutanix AHV VLANs In Mass

December 18, 2020

Looking for a simple way to to import your VLANs into AHV from a XLS or CSV file, see below for example.

PowerShell
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
<#
 
###Add VLANs and VLAN/Network Names from Csv
###Please confirm snapin is installed, from Nutanix, in PC -> ? -> Download CMDlets
 
# Load Nutanix PowerShell SnapIns
$myvarLoaded = Get-PSSnapin -Name NutanixCmdletsPSSnapin -ErrorAction SilentlyContinue | % {$_.Name}
if ($myvarLoaded -eq $null){Add-PSSnapin NutanixCmdletsPSSnapin}
 
# Cluster VIP
$server = Read-Host 'Enter Cluster IP'
 
# Request & Verify credentials
$credentials = Get-Credential -Message "Nutanix Cluster Credentials"
 
$username = $credentials.username
$password = ConvertTo-SecureString $($credentials.GetNetworkCredential().password) -AsPlainText -Force
 
write-host "Connecting to Cluster..."
Connect-NTNXCluster -Server $server -UserName $UserName -Password $password -AcceptInvalidSSLCerts -ForcedConnection
write-host "Cluster Connected - Moving to Create VLANs"
 
###Adjust path, Fields, Variables as needed below.
Import-Csv .\VLAN1.csv -UseCulture | %{
  New-NTNXNetwork -Name $_.Name -Vlan $_.VlanID
}
write-host "VLANs Created - See Above for Net UIDs"

Your fields in the above syntax in the CSV file are simple Name and VlanID

Name VlanID
VLAN182_IPAM 182
VLAN183_DB 183
VLAN184_NET 184

Also can be achieved via ACLI and or completed in the Prism Central/Element Interface as well.

Share

Uncategorized

Leave A Reply


Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *




© Copyright LetsBlog Theme Demo - Theme by ThemeGoods