This script uses WMI to determine whether the system is a PC, laptop or server (download):
'Help Now Consulting
'http://www.help-now.com/
'Josh Cook
Set objShell = CreateObject("WScript.Shell")
OS_Product_Name = objShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProductName")
OS_Product_Type = objShell.RegRead("HKLM\System\CurrentControlSet\Control\ProductOptions\ProductType")
Set objShell = Nothing
'Test for Windows 2003 Server (and hopefully above)
If InStr(1, OS_Product_Name, "server", 1) Then
WScript.Echo("Server")
WScript.Quit(1003)
End If
'Test for Windows 2003 Server
If InStr(1, OS_Product_Name, "windows 2000", 1) And LCase(OS_Product_Type) <> "winnt" Then
WScript.Echo("Server (Windows 2000)")
WScript.Quit(1003)
End If
strComputer = "."
ComputerType = "|"
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colChassis = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure")
For Each objChassis in colChassis
For Each strChassisType in objChassis.ChassisTypes
ComputerType = ComputerType & strChassisType & "|"
Next
Next
If InStr(ComputerType, "|8|") Or InStr(ComputerType, "|9|") Or InStr(ComputerType, "|10|") Or InStr(ComputerType, "|11|") Or InStr(ComputerType, "|14|") Then
WScript.Echo("Laptop")
WScript.Quit(1001)
Else
WScript.Echo("Desktop")
WScript.Quit(1002)
End If
