Forum Discussion
Prabu_MOhan_102
Jan 18, 2016Nimbostratus
This should help identify active standby:-) $Hostname1="F5 Device ip" $Hostname2="F5 Device ip" $Username="Username" $Password="password"
Check and load icontrol Snapin$checkSnapIn = Get-PSSnapIn iControlSnapIn -EA SilentlyContinue If ($checkSnapIn.length -eq 0) { Add-PSSnapIn iControlSnapIn }
Login and Unit Active \Standby check$login = Initialize-F5.iControl -HostName $Hostname1 -Username $Username -Password $Password
if ($login -eq "true") { Write-Host Logged into $Hostname1 F5 successfully.; $ISactive = Get-F5.DBVariable -Name Failover.State | select Value | ft -hide |Out-String
if ( $ISactive.trim() -eq "active")
{
Write-Host "Device" $Hostname1 is $ISactive.trim();
} else {
$login = Initialize-F5.iControl -HostName $Hostname2 -Username $Username -Password $Password
if ($login -eq "true")
{
Write-Host Logged into $Hostname2 F5 successfully.;
$ISactive = Get-F5.DBVariable -Name Failover.State | select Value | ft -hide |Out-String
Write-Host "Device" $Hostname2 is $ISactive.trim();
if ( $ISactive.trim() -ne "active"){
Write-Host "Something went wrong both servers are not set active";
}
}else{
Write-Host "Login in Failed."
}
}
}else { Write-Host "Login in Failed." }