General discussion


Detecting a laptop from a batch file

By curtis ·
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.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Naming conventions

by CharlieSpencer In reply to Detecting a laptop from a ...

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.

Related Discussions

Related Forums