PLEASE POST ANY RESULTS. First:- Turn off the computer, press and hold the PWR button for 4 seconds.
Then - Leave only keyboard and mouse connected, disconnect all externally connected devices such as Docking Station, USB storage devices, displays, and printers. Unplug the AC adapter from the computer.
Next - Press and Hold the Power button for 15 seconds to Hard Reset. Rinse and Repeat; Re-Connect the AC adapter.
NOW begin checking/testing/proving the Hardware is fit for purpose. Power on your PC, press ESC (repeatedly), then F2 at the prompt. Choose System Tests (Fast Test does a 4 minute hardware check).
From 2016 onwards there is a possible recovery option via the cloud... HP Consumer PCs - Using the HP Cloud Recovery Tool (Windows 7 & 10) https://support.hp.com/us-en/document/c06162205 OR Turn off the computer. Disconnect all connected devices and cables, Media Drives, USB drives, printers, & faxes. Remove media from internal drives, and remove any recently added internal hardware. Do not disconnect the monitor, keyboard, mouse, or power cord. WARNING - ONE WAY ONLY, WIPES ALL DATA - NON-RECOVERABLE Turn on the computer and repeatedly press the F11 key, about once every second, until the Choose an option screen is displayed, and then continue.
On the Choose an Option screen, click Troubleshoot, and work your way through the screens.
Return it and get a refund, it maybe that the HDD has suffered some shock in transit and hence the F2 diagnostics.