Networks do not typically work that way.
You have to gain access to the network first. If you are on a domain then you can be validated for a domain logon.
But networks are setup to provide connectivity, the individual resources you go after on the network get configured to allow/deny by whatever criteria you setup but connectivity is there, access is restricted.
In any event, any type of script to auto-configure a WLAN setup would be dependent on the particular wireless hardware being used and it's drivers. It could vary based on driver and hardware revisions even if all of the machines used the same brand/model of wireless interface.
I have seen the same model laptops come with built in WLAN using different manufacturer chipsets, let alone the ones of the same manufacturer at different hardware or software revisions.
Yes, you could probably script something but it would be highly variable and the approach would be based on however the hardware/software is implemented.
At my age I still learn something new every day, but I forget two others.