I upgraded to OS X Lion (10.7) recently, only to boot up, login, and have my computer shut right back off again. Booted up, logged in — same thing.
I logged in with a different account on the same computer, and it didn't have a problem. The computer ran fine.
I couldn't help but think about the old computer geek prank of writing a startup script to auto-run at login. Then it occurred to me: I always use an Applescript on my desktop to shut down instead of choosing " > Shut Down." However, Lion has this nifty set of functions called "resume" that opens programs up to the same state they were in when you closed them. Another feature is that it opens whatever files you had opened when you logged out/shut down. Since the last file I had opened was the shutdown Applescript, that was the first thing it opened every time I logged in. So I had pulled a prank on myself.
Well, I patted myself on the back for realizing what the problem was, but I still had to fix it. I opted to open up Terminal, login as root and delete the file, since the account I had logged into the desktop as did not have access to it. Logged out, logged in with my main account, not auto-shutdown. Problem solved.