Using VMware.Sdk.Nsx.Policy: Commands for NSX

VCF PowerCLI 9.0 now includes a module called VMware.Sdk.Nsx.Policy, this modules contains auto-generated cmdlets to support NSX Policy Public APIs. Use can use this post as a quick reference guide.

Connecting to a NSX Instance with Local Credentials

  1. Start a PowerShell session.

  2. Connect to a NSX instance using local credentials by running the following command:

1Connect-NsxServer -Server sfo-m01-nsx01.sfo.rainpole.io -User admin -Password VMw@re1!VMw@re1!
  1. Once connected the following information is stored in $defaultNsxConnections.
 1ServiceUri     : https://sfo-m01-nsx01.sfo.rainpole.io/
 2SessionSecret  :
 3User           : admin
 4IsConnected    : True
 5Id             : /NsxServer=[email protected]:443/
 6Name           : sfo-m01-nsx01.sfo.rainpole.io
 7Uid            : /NsxServer=[email protected]:443/
 8ProductVersion : 9.0.0.0.24705144
 9ServerUri      : https://sfo-m01-nsx01.sfo.rainpole.io/
10UUID           : /NsxServer=[email protected]:443/
11Port           : 443
  1. Disconnect from a NSX instance by running the following command:
1Disconnect-NsxServer -Server sfo-m01-nsx01.sfo.rainpole.io

NOTE

The VMware.Sdk.Nsx.Policy module contains a lot of cmdlets which do not display well in a blog post so for this module you can view the commands within relevant text files located on my GitHub repository.


Display All NSX GET Command Details

  1. Start a PowerShell session.

  2. Display all GET cmdlets supported in VMware.Sdk.Nsx.Policy by running the following command:

1Get-NsxOperation -Method Get | Select-Object CommandInfo, Path, Method
  1. To view the output for all GET cmdlets in VMware.Sdk.Nsx.Policy see VMware.Sdk.Nsx.Policy.GET.txt .

Display All NSX POST Command Details

  1. Start a PowerShell session.

  2. Display all POST cmdlets supported in VMware.Sdk.Nsx.Policy by running the following command:

1Get-NsxOperation -Method Post | Select-Object CommandInfo, Path, Method
  1. To view the output for all POST cmdlets in VMware.Sdk.Nsx.Policy see VMware.Sdk.Nsx.Policy.POST.txt .

Display All NSX PUT Command Details

  1. Start a PowerShell session.

  2. Display all PUT cmdlets supported in VMware.Sdk.Nsx.Policy by running the following command:

1Get-NsxOperation -Method Put | Select-Object CommandInfo, Path, Method
  1. To view the output for all PUT cmdlets in VMware.Sdk.Nsx.Policy see VMware.Sdk.Nsx.Policy.PUT.txt .

Display All NSX PATCH Command Details

  1. Start a PowerShell session.

  2. Display all PATCH cmdlets supported in VMware.Sdk.Nsx.Policy by running the following command:

1Get-NsxOperation -Method Patch | Select-Object CommandInfo, Path, Method
  1. To view the output for all PATCH cmdlets in VMware.Sdk.Nsx.Policy see VMware.Sdk.Nsx.Policy.PATCH.txt .

Display All NSX DELETE Command Details

  1. Start a PowerShell session.
  2. Display all DELETE cmdlets supported in VMware.Sdk.Nsx.Policy by running the following command:
1Get-NsxOperation -Method Delete | Select-Object CommandInfo, Path, Method
  1. To view the output for all DELETE cmdlets in VMware.Sdk.Nsx.Policy see VMware.Sdk.Nsx.Policy.DELETE.txt .

Posts in this Series