After winter storage took my 2006 M5 out and quickly had COG &Transmission fail! on 2006 BMW M5

In drive SMG would not engage...engine would just rev.Suddenly it would catch and lurch forward.Then it would clear for several miles...then reappear again.Changed battery as it was suggested by dealer that 6 yr.old battery may not power all the onboard electronics.Red "COG" is now back with a vengeance
Yesterday RED COG again, would not engage in drive or reverse and then stalled and would not restart[middle of rush hour intersection]5 minutes later it started and ran without problems.What is going on?

Asked by for the 2006 BMW M5
I would suggest your clutch is going and you need to replace it! You can drive a little bit like that but you can do damage.
1 more answer
Sounds to me the main computer on your car is damaged or not properly connected, these cars are so complicated that if one wire is off it will count it as a part default thus not allowing your car to drive. make sure all wire is properly and still in working order.