If IsLaptop( "." ) Then WScript.Echo "Laptop" Else WScript.Echo "Desktop or server" End If Function IsLaptop( myComputer ) ' This Function checks if a computer has a battery pack. ' One can assume that a computer with a battery pack is a laptop. ' ' Argument: ' myComputer [string] name of the computer to check, ' or "." for the local computer ' Return value: ' True if a battery is detected, otherwise False ' ' Written by Rob van der Woude ' http://www.robvanderwoude.com On Error Resume Next Set objWMIService = GetObject( "winmgmts://" & myComputer & "/root/cimv2" ) Set colItems = objWMIService.ExecQuery( "Select * from Win32_Battery", , 48 ) IsLaptop = False For Each objItem in colItems IsLaptop = True Next If Err Then Err.Clear On Error Goto 0 End Function