If the illumination is on, that is the dash lights. That is not the signal to the GEM working. 2 different circuits.
The status of the 4WD switch is shown on the instrument cluster.
You replaced all the relays ( didn't test them ) so that is not it, unless you cannot say for sure the relays you were using were good ( thus the reason to test the relays, not just remove and replace ).
If it works some times, and not others, that could be down to the vacuum solenoid also. You keep looking for yet another relay to replace, when it could be a mechanical item.
The GEM controls and reads the position of the 4WD system, and reports it back in terms of the 4WD indicator lamps on the cluster.
There is a CEL also, anything else ?
You might want to think about taking it to a shop, and have them work on it.
Your approach to problem diagnoses is a bit scattered, and you leave important information out when asking for help, and are just replacing items, and shorting wires together without knowing what you are doing.
Did you read the thread above, and follow some of the steps ?