Narrative:

On climb out from ZZZ; complete electrical failure occurred before being handed off to departure control. Engine performance was normal. I thought the avionics master switch had failed since all the radios and transponder were blank. I got out my handheld radio and tried to reach ATC at ZZZ. I could hear them but they apparently cold not hear me. I planned to fly to ZZZ2; enter the pattern and wait for light signal auths; or maybe the handheld would transmit once in closer range. I flew toward ZZZ2 and attempted to lower approach flaps; and discovered that all electrical power had failed. I then flew north of ZZZ2 and got out the checklist for manual gear extension. I wiggled the battery and alternator switches with no response. Then; while starting the gear extension checklist; all power came back on. I lowered the gear and approach flaps. I contacted ZZZ1 approach and told them I wanted to land at ZZZ2 before the power went off again. They told me to contact ZZZ2 and said they would call them to warn them of my possible problem. I contacted ZZZ2 and asked for the tower to visually confirm the gear was extended. They did and I was cleared to land at runway xx at ZZZ2. I think I may have violated ZZZ2 airspace without a clearance during the time I was dealing with the power failure and possible gear extension; but I felt it was better to go to ZZZ2 rather than the busy class C; ZZZ1. My mechanic feels there is a bad wire connection or relay to be tracked down.

Google
 

Original NASA ASRS Text

Title: A BE33 LOST ELECTRICAL POWER AFTER TKOF AND WHILE ON AN APCH TO A NEARBY ARPT REGAINED ELECTRICAL TO LOWER THE LNDG GEAR AND GET LNDG CLRNC.

Narrative: ON CLBOUT FROM ZZZ; COMPLETE ELECTRICAL FAILURE OCCURRED BEFORE BEING HANDED OFF TO DEP CTL. ENG PERFORMANCE WAS NORMAL. I THOUGHT THE AVIONICS MASTER SWITCH HAD FAILED SINCE ALL THE RADIOS AND XPONDER WERE BLANK. I GOT OUT MY HANDHELD RADIO AND TRIED TO REACH ATC AT ZZZ. I COULD HEAR THEM BUT THEY APPARENTLY COLD NOT HEAR ME. I PLANNED TO FLY TO ZZZ2; ENTER THE PATTERN AND WAIT FOR LIGHT SIGNAL AUTHS; OR MAYBE THE HANDHELD WOULD XMIT ONCE IN CLOSER RANGE. I FLEW TOWARD ZZZ2 AND ATTEMPTED TO LOWER APCH FLAPS; AND DISCOVERED THAT ALL ELECTRICAL PWR HAD FAILED. I THEN FLEW N OF ZZZ2 AND GOT OUT THE CHKLIST FOR MANUAL GEAR EXTENSION. I WIGGLED THE BATTERY AND ALTERNATOR SWITCHES WITH NO RESPONSE. THEN; WHILE STARTING THE GEAR EXTENSION CHKLIST; ALL PWR CAME BACK ON. I LOWERED THE GEAR AND APCH FLAPS. I CONTACTED ZZZ1 APCH AND TOLD THEM I WANTED TO LAND AT ZZZ2 BEFORE THE PWR WENT OFF AGAIN. THEY TOLD ME TO CONTACT ZZZ2 AND SAID THEY WOULD CALL THEM TO WARN THEM OF MY POSSIBLE PROB. I CONTACTED ZZZ2 AND ASKED FOR THE TWR TO VISUALLY CONFIRM THE GEAR WAS EXTENDED. THEY DID AND I WAS CLRED TO LAND AT RWY XX AT ZZZ2. I THINK I MAY HAVE VIOLATED ZZZ2 AIRSPACE WITHOUT A CLRNC DURING THE TIME I WAS DEALING WITH THE PWR FAILURE AND POSSIBLE GEAR EXTENSION; BUT I FELT IT WAS BETTER TO GO TO ZZZ2 RATHER THAN THE BUSY CLASS C; ZZZ1. MY MECH FEELS THERE IS A BAD WIRE CONNECTION OR RELAY TO BE TRACKED DOWN.

Data retrieved from NASA's ASRS site as of May 2009 and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.