Forum Discussion
Hi,
Please check out the PowerShell module that I and others developed for scripting the Big-IP LTM. It's available here: https://github.com/joel74/POSH-LTM-Rest/
Out of curiosity, which articles on PS integration did you find that were outdated?
Thanks, Joel
- jonats_288702Sep 08, 2016Nimbostratus
Hi Joel,
Thanks for the response. I'm trying the script but unfortunately I can't make it work. I'm still new to F5 Big-IP so I'm not sure if I'm passing the right values.
I followed the readme file but I think I'm passing the wrong value in $MyLTM_IP New-F5Session -LTMName $MyLTM_IP -LTMCredentials $mycreds -PassThrough
The website of our Big IP is https://[IP]/xui/ and I'm passing the [IP] to $MyLTM_IP
Am I doing it right?
- Joel_Newton_449Sep 08, 2016Cirrus
Hi, Jonats, It sounds like you're doing it right. Are you getting any response / error back? Cheers, Joel
- jonats_288702Sep 08, 2016Nimbostratus
There is no error in creating a session. Right after the New-F5Session command, it says that base URL is https://[IP]/mgmt/tm/ltm which is different to our f5 website (https://[IP]/xui/)
Then I try Get-Pool [pool name] and get the error below. A window will also pop-up for credentials so I guess it wasn't able to get the session eventhough I use -PassThrough
Test-F5Session : You must either create an F5 Session with script scope (by calling New-F5Session) or pass an F5 session At C:\PowerShell\Modules\F5-LTM\Public\Get-Pool.ps1:25 char:9 + Test-F5Session($F5Session) + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-F5Session
ConvertFrom-Json : Cannot bind argument to parameter 'InputObject' because it is null. At C:\PowerShell\Modules\F5-LTM\Public\Invoke-RestMethodOverride.ps1:36 char:50 + $message = $_.ErrorDetails.Message | ConvertFrom-json | Select-Objec ... + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [ConvertFrom-Json], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertFromJs
Invoke-RestMethodOverride : " : At C:\PowerShell\Modules\F5-LTM\Public\Get-Pool.ps1:32 char:21 + $JSON = Invoke-RestMethodOverride -Method Get -Uri $URI -Credential ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-RestMethodOverride
- Joel_Newton_449Sep 08, 2016Cirrus
Hi, Jonats,
Thanks - I believe that helps clarify things. The URL for using the REST API should be different than the management URL you hit in the browser, so that's fine.
When you create a new LTM session, you either have the option of setting it as the default session and then you don't have to pass it to functions (accomplished by using the -Default switch on New-F5Session) or you can store the object passed back by New-F5Session and pass it as a param to the functions like Get-Pool. Try adding -Default to your New-F5Session call and see if that fixes the issue for you.
Thanks, Joel