diff --git a/CHANGELOG.md b/CHANGELOG.md index a87a287..a85cf16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). * Bug fixes * Fixed bug where extraneous Out-Null files were created when calling some functions (via @iainbrighton) + * Fixed bug where Get-NSLBVirtualServerBinding didn't return lbvserver_service_binding objects (via @myllyja) ## 1.7.0 (2018-07-02) * Features diff --git a/NetScaler/Public/Get-NSLBVirtualServerBinding.ps1 b/NetScaler/Public/Get-NSLBVirtualServerBinding.ps1 index 101d940..2b7fc61 100644 --- a/NetScaler/Public/Get-NSLBVirtualServerBinding.ps1 +++ b/NetScaler/Public/Get-NSLBVirtualServerBinding.ps1 @@ -71,16 +71,21 @@ function Get-NSLBVirtualServerBinding { } else { $vServers = Get-NSLBVirtualServer -Session $Session -Verbose:$false foreach ($item in $vServers) { - $response = _InvokeNSRestApi -Session $Session -Method Get -Type lbvserver_servicegroup_binding -Resource $item.name - if ($response.errorcode -ne 0) { throw $bindings } - if ($response.PSobject.Properties.name -contains 'lbvserver_servicegroup_binding') { - $result += $response.lbvserver_servicegroup_binding - } - if ($response.PSobject.Properties.name -contains 'lbvserver_service_binding') { - $result += $response.lbvserver_service_binding + $response = @() + $response += _InvokeNSRestApi -Session $Session -Method Get -Type lbvserver_servicegroup_binding -Resource $item.name + if ($response.errorcode -ne 0) { throw $response } + $response += _InvokeNSRestApi -Session $Session -Method Get -Type lbvserver_service_binding -Resource $item.name + + foreach ($entry in $response) { + if ($entry.PSobject.Properties.name -contains 'lbvserver_servicegroup_binding') { + $result += $entry.lbvserver_servicegroup_binding + } + if ($entry.PSobject.Properties.name -contains 'lbvserver_service_binding') { + $result += $entry.lbvserver_service_binding + } } } } return $result } -} \ No newline at end of file +}