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]
[-Server <CisServer[]>]
[CommonParameters]
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
optional |
|
String[] | named |
|
Specifies the service type ID. | optional |
|
CisServer[] | named |
|
Specifies the NSX-T servers on which you want to run the cmdlet. If no value is provided or $null value is passed 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
# Retrieves the logical routers service.
$logicalRoutersService = Get-NsxtService -Name 'com.vmware.nsx.logical_routers'
# Creates an input argument for the creation of a logical router.
$logicalRouterCreateSpec = $logicalRoutersService.Help.create.logical_router.Create()
# Fills in the create specification properties.
$logicalRouterCreateSpec.display_name = "MyLogicalRouter"
$logicalRouterCreateSpec.router_type = "TIER1"
# Creates the logical router entity.
$logicalRouter = $logicalRoutersService.create($logicalRouterCreateSpec)
# Retrieves the logical router ports service.
$logicalRouterPortsService = Get-NsxtService -Name 'com.vmware.nsx.logical_router_ports'
# Creates the input argument for logical router downlink port creation.
$logicalRouterPortCreateSpec = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.Create()
# Fills in the properties of the logical router port create specification.
$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()
# Creates a subnet element.
$subnet = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.subnets.Element.Create()
# Fills in the subnet properties.
$subnet.ip_addresses = @('11.11.11.11')
$subnet.prefix_length = 22
# Adds a subnet to the subnets collection of the logical router port create specification.
$logicalRouterPortCreateSpec.subnets.Add($subnet)
# Creates the logical router downlink port entity.
$logicalRouterPortsService.create($logicalRouterPortCreateSpec)
Creates logical router and logical router downlink port entities.
Related Commands
NsxtService
This cmdlet retrieves PSObject objects that represent a proxy to an NSX-T API service.