If you are having the problem like the picture in alexander leong's post, that means the system is booting into safe mode.
When you turn on your iMac, if you see that grey progress bar, you system is booting into safe mode, PERIOD. If booting with the keyboard and mouse off didn't fix your problem, then you have a different problem.
alexander leong's post is caused by the system going into safe mode. If you don't see that bar, then you have a different problem. And if you do see that bar with bluetooth devices off, then your system's firmware is updating or you have a unrelated problem.
Macbooks have this problem too, but it is not because of safe mode, the wife hardware is actually messed up after upgrading. To all the people ignoring my post or just answering saying it still does this after BT devices are off, check your bootup screen for that grey bar.
I have 2010 and 2011 model iMacs and using wired keyboards and mice or not turning on the BT devices until after I see the desktop solved my problem. I have 4 iMacs and a few Mac Minis... and ALL of them boot into safe mode with the BT devices on.
After it asks you to log in, just hit restart and your wifi will work again anyways. But Macbook users, there is no fix because the wifi hardware really has a problem.
BTW: If you check out the other 10 or so posts I've answered all the people booted fine when BT devices are off. And this little tidbit of information came from Apple Care after I called them 4 times. Just to let you know, they are aware of the problem and don't think it is a problem.