I would like to know if a computer is a Desktop or a Laptop.
I have tried retrieving the information using Powershell and batch script but I am having trouble interpretting it because some code produced "No Instance(s) Available", some the number "2" etc. I am really close but can't quite get the correct answer. Basically, if the computer is a laptop I want the output to be Laptop, and if the computer is a desktop I want the output to be Desktop. I thought the battery would be a reasonable and solid item to look at for this determination!
Here is a small fraction of the code I have tried . . .
Code: Select all
For /f "Tokens=2 Delims==" %%a In ('WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Value') Do Set Battery1=%%a
Code: Select all
For /f "Tokens=2 Delims==" %%a In ('WMIC PATH Win32_Battery Get Description /Value') Do Set Battery2=%%a
Code: Select all
For /f "usebackq Delims=" %%a In (`powershell -command "& {(Get-WmiObject Win32_Battery).BatteryStatus}"`) Do Set "Battery3=%%a"
Code: Select all
For /f Tokens=2 Delims='='" %%a In (`powershell -command "& {Get-WmiObject -Class Win32_Battery Description}"`) Do Set "Battery4=%%a"