Get-NsxtService

This cmdlet retrieves PSObject objects that represent a proxy to a NSX-T API service and can be used to invoke the operations of the NSX-T API service. The cmdlet returns one PSObject object for every service available on NSX-T server.

Syntax

[-Name  <String[]>]
[-Server  <CisServer[]>]
[CommonParameters]

Parameters

Required Parameter Name Type Position Features Description
optional
Name
String[] named
  • wildcards
  • Specifies the service type ID.
    optional
    Server
    CisServer[] named Specifies the NSX-T servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-NsxtServer.

    Output

    System.Management.Automation.PSObject

    Examples


    Example 1

    $userService = Get-NsxtService -Name "com.vmware.nsx.aaa.user_info"
    $userService.get()

    Retrieves the binding for the specified service and invokes a service operation.

    Example 2

    # Retrieve Logical Routers Service
    $logicalRoutersService = Get-NsxtService -Name 'com.vmware.nsx.logical_routers'
    # Create input argument for creation of a logical router
    $logicalRouterCreateSpec = $logicalRoutersService.Help.create.logical_router.Create()
    # Fill in the create spec properties
    $logicalRouterCreateSpec.display_name = "MyLogicalRouter"
    $logicalRouterCreateSpec.router_type = "TIER1"
    # Create Logical Router Entity
    $logicalRouter = $logicalRoutersService.create($logicalRouterCreateSpec)
    # Retrieve logical router ports service
    $logicalRouterPortsService = Get-NsxtService -Name 'com.vmware.nsx.logical_router_ports'
    # Create Input argument for logical router downlink port creation
    $logicalRouterPortCreateSpec = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.Create()
    # Fill in the properties of the logical router port create spec
    $logicalRouterPortCreateSpec.logical_router_id = $logicalRouter.id
    $logicalRouterPortCreateSpec.display_name = "MyLogicalRouterDownlinkPort"
    $logicalRouterPortCreateSpec.subnets = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.subnets.Create()
    # Create subnet element
    $subnet = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.subnets.Element.Create()
    # Fill in subnet properties
    $subnet.ip_addresses = @('11.11.11.11')
    $subnet.prefix_length = 22
    # Add subnet into the subnets collection of the logical router port create spec
    $logicalRouterPortCreateSpec.subnets.Add($subnet)
    # Create Logical Router Downlink Port Entity
    $logicalRouterPortsService.create($logicalRouterPortCreateSpec)

    Creates logical router and logical router downlink port entities.

    Related Commands

    Feedback

    Was this page helpful?