Hi i wanted connect to API to NSX Manager because i need get amount of session VPN SSL. This value i will need to ise inside script wchich willbe upgrade only EDGES without active users.
I used instruction from this book: https://subscription.packtpub.com/book/virtualization_and_cloud/9781786468017/14/ch14lvl1sec135/conn...
and created simple test on to estabilish connection but looks like something is not working and i dont understand why.
### Autorization
$NSXManager = 'NSXMANAGER'
$Username = 'admin'
$Password = 'PASSWORD'
###
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$Username`:$Password"))
$Headers = @{Authorization = "Basic $base64AuthInfo"}
###
#URI
$Uri = "https://$NSXManager/api/2.0/services/vcconfig"
$xml = Invoke-RestMethod -Uri $Uri -Method Get-Headers $Headers
$xm
Error:
Invoke-RestMethod : Cannot bind parameter 'Method'. Cannot convert value "Get-Headers" to type "Microsoft.PowerShell.Commands.WebRequestMethod". Error: "Unable to match the identifier name Get-Headers to a valid enumerator name. Specify one of the following enu
merator names and try again:
Default, Get, Head, Post, Put, Delete, Trace, Options, Merge, Patch"
At line:1 char:44
+ $xml = Invoke-RestMethod -Uri $Uri -Method Get-Headers $Headers
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-RestMethod], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
URI which i will use: https://NSXMANAGER/api/4.0/edges/edge-566/sslvpn/activesessions
Please about help.
vExpert VSAN/NSX/CLOUD | VCAP5-DCA | VCP6-DCV/CMA/NV ==> akademiadatacenter.pl