5 Replies Latest reply on Sep 12, 2018 7:19 AM by KKSAdmin

    How to PowerCLI/PowerNSX with NSX-T 2.2

    KKSAdmin Novice

      Installed PowerCLI 10.2.


      I can Connect-NSXTServer all day long, but then any command results in:


      "The variable '$defaultNSXConnection' cannot be retrieved because it has not been set."


      I tried installing the PowerCLI Fling for NSX-T which had no apparent impact.


      How do I run PowerNSX Commands against NSX-T?


      Right now I am trying to use New-NSXIPSet but will have others I will need to use.


      Thanks!2018-09-11 17_02_26- - Remote Desktop Connection.png

        • 1. Re: How to PowerCLI/PowerNSX with NSX-T 2.2
          daphnissov Guru
          Community WarriorsvExpert

          PowerNSX only supports NSX-V. If you need NSX-T PowerShell bindings you'll have to follow the instructions and use the Fling which requires PowerCLI 10.0.

          • 2. Re: How to PowerCLI/PowerNSX with NSX-T 2.2
            KKSAdmin Novice

            Thanks.  I tried that but it did not help.  Or are you saying that I need to downgrade PowerCLI from 10.2 to 10.0 to use the Fling?



            • 3. Re: How to PowerCLI/PowerNSX with NSX-T 2.2
              KKSAdmin Novice

              I downgraded to Power CLI 10.0 and it made no difference.


              The only thing I could find is that some of the DLLs were in a blocked state.  I unblocked each DLL and then tried to re-register from a new Admin PowerCLI window.


              The Install-Module command runs without error but doesn't provide any feedback.  It runs for maybe 3 seconds and then returns to a prompt.  No errors, but no confirmation message either.2018-09-11 18_40_09- - Remote Desktop Connection.png

              • 4. Re: How to PowerCLI/PowerNSX with NSX-T 2.2
                DaleCoghlan Enthusiast
                VMware Employees

                PowerNSX and the NSX-T module for PowerCLI are 2 totally separate products, and as such there is no interoperability with them.


                There are only 3 cmdlets included with the PowerCLI NSX-T module:

                PS > get-command -Module VMware.VimAutomation.Nsxt


                CommandType     Name                                               Version    Source

                -----------     ----                                               -------    ------

                Cmdlet          Connect-NsxtServer                                 10.2.0.... VMware.VimAutomation.Nsxt

                Cmdlet          Disconnect-NsxtServer                              10.2.0.... VMware.VimAutomation.Nsxt

                Cmdlet          Get-NsxtService                                    10.2.0.... VMware.VimAutomation.Nsxt


                To use the module to create an IP Set in NSX-T, you will need to do the following:


                # Connect to your NSX Manager

                Connect-NsxtServer -Server -user admin -password VMware1!


                # Create a service object for the particular service your interested in. To view all the services available, just issue Get-NsxtService

                $ipsetService = Get-NsxtService com.vmware.nsx.ip_sets


                # Use the built in help to generate the required spec

                $specIpSet = $ipsetService.help.create.ip_set.create()


                # set the appropriate details

                $specIpSet.display_name = "MyIPSET"

                $specIpSet.description = "Created by P



                # If you want to tag the object, use the help to create the tag spec

                $specTag1 = $ipsetService.help.create.ip_set.tags.Element.Create()


                # Add the tag details to the spec

                $specTag1.scope = "environment"

                $specTag1.tag = "production"


                # Add the tag spec to the tags property



                # Create the IPSet using the spec



                # Output returned.


                Help               : @{Documentation=IPSet is used to group individual IP addresses, range of IP addresses or subnets. An IPSet is a homogeneous group of IP addresses, either

                                     of type IPv4 or of type IPv6. IPSets can be used as source or destination in firewall rules. These can also be used as members of NSGroups.; links=;

                                     schema=; self=; revision=; create_time=; create_user=; last_modified_time=; last_modified_user=; protection=; system_owned=; description=; display_name=;

                                     id=; resource_type=; tags=; ip_addresses=}

                resource_type      : IPSet

                description        : Created by PowerCLI

                id                 : e9997b2a-0630-4e84-9cdf-1f761310c8d2

                display_name       : MyIPSET

                tags               : {@{Help=; scope=environment; tag=production}}

                ip_addresses       : {}

                create_user        : admin

                create_time        : 1536729497482

                last_modified_user : admin

                last_modified_time : 1536729497482

                system_owned       : False

                protection         : NOT_PROTECTED

                revision           : 0

                links              :

                schema             :

                self               :

                1 person found this helpful
                • 5. Re: How to PowerCLI/PowerNSX with NSX-T 2.2
                  KKSAdmin Novice

                  Thanks so much Dale -- I'll give this a spin.


                  We are being pushed to move to T for container/PKS capabilities.  A V>T migration is decidedly more complicated when you lose your cmdlets .  I'm sure this will be in a future release.