Friday, 3 August 2012
Check if a Machine is Laptop - VBScript
dim l_objService
dim l_objEnum
dim l_boolIsLaptopNotebookOrTablet : l_boolIsLaptopNotebookOrTablet = false
set l_objService = getObject("winmgmts:root\cimv2")
set l_objEnum = l_objService.ExecQuery("select __relpath, chassisTypes from Win32_SystemEnclosure")
for each l_objChassis in l_objEnum
if IsArray(l_objChassis.ChassisTypes) then
for l_intItem = lbound(l_objChassis.ChassisTypes) to ubound(l_objChassis.ChassisTypes)
l_intType = l_objChassis.ChassisTypes(l_intItem)
if l_intType = 8 or l_intType = 9 or l_intType = 10 then
l_boolIsLaptopNotebookOrTablet = true
msgbox l_boolIsLaptopNotebookOrTablet
end if
next
end if
next
if IsObject(l_objService) then
set l_objService = nothing
end if
if l_boolIsLaptopNotebookOrTablet = true then
wscript.quit 1
else
wscript.quit 0 ' not a computer system that we are concerned about in this package
end if
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment