If during an avast! scan,
1. avast! freezes or crashes, it's probably avast! problem.
2. The computer freezes or restarts, it could be e.g. a conflict with some other program, or a hardware problem.
3. The computer powers down - it's probably a hardware problem (e.g. overheating). The scan generates a lot of hard disk activity (and is also CPU intensive), which may increase the temperature of your hardware. I suggest to check the coolers in the case.
4. If you get a blue screen, it could have a bug in avast! drivers (but then, there is not a power down).
Which is your Windows? And firewall? Other security program that could interfere?