Discussion Locked

Detecting a laptop from a batch file

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have never seen a foolproof way to detect a laptop from a batch file, and the WMI scripts out there aren't 100% either. However, I use a couple of methods that may be helpful:

ipconfig | find "Wireless" > nul
if errorlevel 0 if not errorlevel 1 goto laptop

This method works by looking for WiFi, if your org doesn't have many standalone PCs with WiFi cards. The problem with this is if the laptop's WiFi switch is off or the WiFi interface is disabled from Network Connections, it doesn't show up in ipconfig.

ipconfig /all | find "Dhcp Enabled. . . . . . . . . . . : Yes"
if errorlevel 0 if not errorlevel 1 goto laptop

The above method works well if the only DHCP Windows PCs logging into your domain are laptops. In our case, all desktops have static IPs.

1 reply

by charliespencer

All our laptops are named beginning with 'LTxxxx'. Our desktops are named 'DTxxxx', and tablets are 'TAxxxx'. The first 'x' / third character is a letter indicating the building or facility.

I realize it may be too late for you, but maybe others can benefit. It's a lot easier to search for a known field.

This discussion is closed to new replies.