PowerShell module for the F5 LTM REST API
Problem this snippet solves: To report an issue with the F5-LTM or F5-BIGIP modules, please use the Issues sections of the GitHub repos (here and here) instead of commenting here. Thanks!
This Pow...
Updated Jun 06, 2023
Version 2.0Joel_Newton
Cirrus
Joined September 06, 2012
ELtheNINO_31450
Nimbostratus
Jul 14, 2017When using a try catch block with Get-Virtualserver the error terminates in the try block
EXAMPLE:
try
{
get-VirtualServer -F5Session -Name |select rules
}
catch [System.Exception]
{
Write-Host "NOPE $_.Exception.Message" -ForegroundColor Cyan
}
It returns:
Invoke-F5RestMethod : "404 Not Found: 01020036:3: The requested Virtual Server (/Common/EnterSomethingFalse) was not found. At C:\Program Files\WindowsPowerShell\Modules\F5-LTM\1.4.196\Public\Get-VirtualServer.ps1:42 char:21 + ... $JSON = Invoke-F5RestMethod -Method Get -Uri $URI -F5Session $F5S ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
INSTEAD OF in the catch block
NOPE. ERROR MESSAGE
Is anyone else experiencing this?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)