I'm hoping I can get a helping hand here. I love linux shell scripting and I decided to give Windows Powershell a try for the following challenge and I'm failing miserably.
I want to run the following command which outputs the GPU temperature and CPU utilization as the 4th and 5th columns. If the 4th column falls below 50, or the 5th column falls below 80 I want to reboot my system.
"C:\Program Files\NVIDIA Corporation\NVSMI>nvidia-smi" --query-gpu=timestamp,name,pci.bus_id,temperature.gpu,utilization.gpu,utilization.memory --format=csv -l 5
Sample of what the command prints every 5 seconds:
2018/05/21 21:21:54.118, GeForce GTX 1060 6GB, 00000000:01:00.0, 63, 100 %, 93 % 2018/05/21 21:21:59.121, GeForce GTX 1060 6GB, 00000000:01:00.0, 64, 100 %, 95 % 2018/05/21 21:22:04.122, GeForce GTX 1060 6GB, 00000000:01:00.0, 64, 100 %, 94 %
I can easily do this with bash, how would I approach this with Powershell? I'm hoping learning this will get me to understand Powershell. Thanks.