Forum Discussion
Sheela_Narayan_
Nimbostratus
Dec 27, 2015Need help to identify which is the active load balancer from PowerShell cmdlets
Need help to identify which is the active load balancer from PowerShell cmdlets and also need to know if can initiate a sync from an active load balancer to passive load balancer using PowerShell. ...
Prabu_MOhan_102
Nimbostratus
Jan 18, 2016Hi ,
Just realised my last post wasn't that good :-).. below if the proper one !
$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." }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects