If you are using your own WiFi router and if you forget the WEP or WPA key, the easiest option is to create a new key! After all you have complete access to your router!
But what if you are connecting to an external WiFi router? The problem is once you enter the key, Windows remembers the key for the network and it won’t ask again. After a couple of days you have forgotten the key. You still have access to wireless network, but you want to find the key Windows is using so that you can back it up! Another scenario is when you want to configure the same wireless network on a different machine.
Fortunately there is a freeware tool(WirelessKeyView) which can display WEP/WPA wireless keys stored by Windows. You can download WirelessKeyView from here. You can see this software in action below.
This utility can recover network key only if it is stored by ‘Wireless Zero Configuration’ service of Windows XP and by the ‘WLAN AutoConfig’ service of Windows Vista. Also note that you need to have administrator access to machine for this to work!
Programs such as this work using Windows API which expose WEP/WPA keys!