Forum Discussion
PowerShell scripting of BigIP
Hi, our company wants to automate Big IP using PowerShell or any windows scripting language. It will be one of those scripts that will be executed in an attempt to automate the server maintenance tasks. Most of our servers are Server 2012 R2 using Powershell v4. Please advise on how we can achieve this. I know there are articles here in PowerShell integration but it doesn't seem to be updated.
6 Replies
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_288702
Nimbostratus
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?
Hi, Jonats, It sounds like you're doing it right. Are you getting any response / error back? Cheers, Joel
- jonats_288702
Nimbostratus
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
The iControl PowerShell snapin is F5's supported and actively maintained for each BIG-IP release with the latest being BIG-IP version 12.1. Download can be available at: https://devcentral.f5.com/d/microsoft-powershell-with-icontrol
I have written quite a few tech tips and code samples on using the PowerShell snapin. Check out the PowerShell page on the https://devcentral.f5.com/wiki/iControl.PowerShell.ashx
There are a few cmdlet's I wrote for specific use cases, but for the most part, I would suggest focusing on the Get-F5.iControl cmdlet which returns an interface object for all of the iControl SOAP APIs documented here: https://devcentral.f5.com/wiki/iControl.APIReference.ashx
Glad to answer any specific questions you have with regards to using this snapin.
-Joe
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com