The javascript solution pointed with errors on the second try of this question have an update from the same author precisely to address javascript errors and to achieve what pointed out on the third try (selected page or link). It's briefly commented on an answeran answer of a linked questionlinked question of this thread.
The best way could be the onethe one by MAllen22842MAllen22842 specially on cases with few site collections; however the updated by Waldek Mastykarz or even the second solution referred on the answer previously mentionedanswer previously mentioned are harder to implement but could be the answer on scenarios of a lot of site collections or dynamical creation of them.