My laptop shuts down after several hours while idle?

I bought a new laptop (a Lenovo V570) with Windows 7 home basic installed to be used as a server, however, the laptop shuts down after being idle for 3-5 hours.

I changed the power management settings so that the computer never sleeps, but it still hibernated itself.

I read a lot of questions about this issue and most of them seemed to be related to overheating, so I tried using a cooling pad with the computer to see if it wouldn't sleep. So far none of these ideas have worked.

I left it on overnight and then read the Windows event logs the next morning. The sleep event log said: "The system is entering sleep. Sleep Reason: System Idle."

Is there a way to stop the system from sleeping after idling for a certain amount of time?

Open the control panel, go Power and Change plan settings.
Then click Change advanced power settings. Settings there, you should find the one which causes the idle.
A guide to changing the power settings can be here.(http://www.sevenforums.com/tutorials/778-power-plan-settings-change.html)

First off, never use a laptop to be used as a server. You need your server to be running at all times for a long time. So cooling and shelf life is important here. If you consider changing to a PC that would be better. Contact me if you want help putting one together.

Second, Some manufactures include software for computer management, it over rides the windows power mgt app. So you should look on manufacturers website to see a solution. Usually you should go to Hibernate and also check never, and it will work fine. Please let me know if this helped you

Joseph is right, running a server from a laptop is a bad idea. Although if its too much to use a PC then there are a few things you can do to boost performance and keep it at a safe temp. As for your question, check the power management settings you have changed again, i noticed that on laptops they have different settings for a "plugged in" machine and one that is running on battery life only. Maybe you have the setting to not sleep on "battery", but while you have it sitting for 3-5 hours you may have it plugged in so the machine uses the default settings for the plugged in machine as well

It is happening because of installation error. While installing somewhere its went wrong… Just re-install and see…