snehasish nandy
snehasish nandy

Reputation: 97

Not able to take F5 session

I am using below code to take F5 session and get the list of health monitors

$MyLTM_IP = "192.168.1.2"
$mycreds = Get-Credential
$session = $null
#Create an F5 session
$session = New-F5Session -LTMName $MyLTM_IP -LTMCredentials $mycreds 
$GetMonitorList = @()
$GetMonitorList = Get-HealthMonitor -F5Session $session

I have installed the F5-LTM module from below reference:

https://gist.github.com/joel74/f5acb78ca7dbe0d87bc95cab98de1388

the code is not giving any error but it is not taking any session(the $session variable to blank)

Please let me know what is the issue here

Upvotes: 0

Views: 75

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 174825

Use the -PassThru switch parameter to make New-F5Session output the resulting session object:

$session = New-F5Session -LTMName $MyLTM_IP -LTMCredentials $mycreds -PassThru

Upvotes: 2

Related Questions