Forester Shaking Problem

Our 2006 Forester started shaking very hard while idling or driving. We drove it to the dealer asap, but the violent shaking had stopped. They hooked it up to the diagnostic machine and everything checked out as fine. This problem happens intermittently so the mechanics have not witnessed it. We’ve even let them keep the car a week and drive it home and back and it never gave them the shaking problem. There is no pattern to when it happens - hot or cold engine, hot or cold outside, just started or been running for awhile, it just doesn’t seem to matter. If we give it some gas while at a stop sign it smooths out a bit but it doesn’t stop the problem. When driving it still shakes but it’s harder to tell how hard. I’m talking about shaking very hard, not just a rough idle. Any ideas?

Does the idle change when it shakes?
Automatic or manual? Next time it happens, see what happens when you shift to neutral.