Hey Matthew,
See this:
Switching WiFi On and Off - #3 by ccstone
-Chris
For more information, see the wiki Searching the Forum for Answers section.