Forum Discussion

ShaneCal_162988's avatar
ShaneCal_162988
Icon for Altocumulus rankAltocumulus
Oct 21, 2016

Check if there are pending changes through iControl PowerShell Snap-in

We're automating setting up new virtual servers, pools and nodes on our standby F5 LTM host through the PowerShell iControl snap-in. We want to programmatically check if there are changes pending between our 2 F5 hosts before our automation makes any changes.

 

Is there a way to check for pending changes through the iControl snap-in?

 

1 Reply

  • I've written a PowerShell function myself to carry out this operation, as I could not find anything online and no one here seems to have done the same:

    function Is-DeviceInSync
    {
        <
        .SYNOPSIS
        Gets the sync status of the F5 device groups
        >
        [CmdletBinding(HelpURI="https://devcentral.f5.com/wiki/iControl.Management__DeviceGroup__SyncStatus.ashx")]
        param
        ()
    
        $syncStatus = (Get-F5.iControl).ManagementDeviceGroup.get_sync_status_overview()
    
        if ($syncStatus.member_state -eq "MEMBER_STATE_STANDALONE")
        {
            write-host "This F5 device is standalone, no sync is required"
            return $true
        }
        elseif ($syncStatus.member_state -eq "MEMBER_STATE_IN_SYNC")
        {
            write-host "This F5 device is in sync with members of its device group, no sync is required"
            return $true
        }
        elseif ($syncStatus.member_state -eq "MEMBER_STATE_NEED_MANUAL_SYNC")
        {
            write-host "This F5 device is not standalone and changes have been made to this device that have not been synced to the device group"
            return $false
        }
        elseif ($syncStatus.member_state -eq "MEMBER_STATE_SYNCING")
        {
            write-host "This F5 device is currently synching with devices in it's group, waiting 10 seconds before checking again..."
            Start-Sleep -Seconds 10
            Is-DeviceInSync
        }
        else
        {
            throw "This F5 device is not in a stable sync state with devices in it's group, please manually verify the sync state of this device before running this script again"
        }
    }