Troubleshoot an unexpected Commander or Standby switch selection

When a switch stack is established and a boot/reboot of the stack is performed, the Commander and Standby are selected based on the configured switch priority. There are other rules in the election process that can override this priority.

Viewing the running configuration with priority

switch(config)# show running-config

; Stack Configuration Editor; Created on release #:KA.15.05.0000x
; Ver #:01:00:01

hostname "Switch"
stacking
member 1 type "J9573A" mac-address 1cc1de-4d87c0
member 2 type "J9573A" mac-address 1cc1de-4dc740
member 3 type "J9575A" mac-address 1cc1de-4dbd40
member 3 priority 200
member 4 type "J9576A" mac-address 1cc1de-4d79c0
member 4 priority 175
member 5 type "J9576A" mac-address 1cc1de-4da900
exit

On a boot of the stack, member 3 becomes a Commander and member 4 becomes a Standby, based on priority. If this were a chain with member 1 at one end of the chain and member 5 at the other end, the number of hops between switches will be part of the election process.