No GPU detected using deviceQuery

Windows7 Ultimate x64
CUDA 8.0
GTX 1050

I am trying to use GTX1050 to compute and use the Intel integrated graphics as primary display.
Now the integrated graphics displays well and GTX1050 can be found in Windows Device Manager as well, but no GPU is detected using deviceQuery. While if using GTX1050 as primary display, deviceQuery can find it.

What is the reason?
Could anyone help me out.

Here is the log of deviceQuery:

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL