You'll need to determine the error before you can find the solution. The first thing you need to do is to disable the automatic restart when there is an error. To do that follow these steps:
1. Go to "Control Panel"
2. Select "System"
3. Go to the "Advanced" tab
4. Select the "Settings" button under the "Startup and Recovery" section
5. Under the "System failure" section, uncheck the "Automatically restart" box
You should now be able to see the error message without the PC restarting. Take note of everything that's on the screen since any of it can be critical in determining the issue. Take special note of any STOP error numbers or any files listed as having caused the issue. In most cases doing a Google search of the error will be enough to get you started in resolving the issue.