Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

docked/undocked

34 views
Skip to first unread message

Brian McDermott

unread,
Sep 2, 2003, 8:25:00 AM9/2/03
to
Does anyone know of a WMI setting that provides info as to whether a laptop
is docked or not?

Torgeir Bakken (MVP)

unread,
Sep 5, 2003, 11:06:50 AM9/5/03
to
Brian McDermott wrote:

> Does anyone know of a WMI setting that provides info as to whether a laptop
> is docked or not?

Hi

You might be so lucky that the computers return 12 (Docking Station) as an
value for the ChassisTypes property in the Win32_SystemEnclosure WMI class when
docked:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_systemenclosure.asp

An extract from a previous post by me
(http://groups.google.com/groups?selm=3D57F055.56BF53EB%40hydro.com):


sComputer = "." ' use "." for local computer

sChassisTypeExact = GetChassisExact(sComputer)
WScript.Echo sChassisTypeExact


Function GetChassisExact(sNode)
Set oShell = CreateObject("WScript.Shell")

Set oEnclosureSet = GetObject("winmgmts://" & sNode & "/root/CIMV2")._
InstancesOf ("Win32_SystemEnclosure")

For Each oEnclosure In oEnclosureSet
If oEnclosure.ChassisTypes(0) <> "" Then
iChassis = oEnclosure.ChassisTypes(0)
End If
Next

Select Case iChassis
Case "1" sDesc = "Other"
Case "2" sDesc = "Unknown"
Case "3" sDesc = "Desktop"
Case "4" sDesc = "Low Profile Desktop"
Case "5" sDesc = "Pizza Box"
Case "6" sDesc = "Mini Tower"
Case "7" sDesc = "Tower"
Case "8" sDesc = "Portable"
Case "9" sDesc = "Laptop"
Case "10" sDesc = "Notebook"
Case "11" sDesc = "Hand Held"
Case "12" sDesc = "Docking Station"
Case "13" sDesc = "All in One"
Case "14" sDesc = "Sub Notebook"
Case "15" sDesc = "Space-Saving"
Case "16" sDesc = "Lunch Box"
Case "17" sDesc = "Main System Chassis"
Case "18" sDesc = "Expansion Chassis"
Case "19" sDesc = "SubChassis"
Case "20" sDesc = "Bus Expansion Chassis"
Case "21" sDesc = "Peripheral Chassis"
Case "22" sDesc = "Storage Chassis"
Case "23" sDesc = "Rack Mount Chassis"
Case "24" sDesc = "Sealed-Case PC"
Case Else sDesc = "No Description"
End Select

GetChassisExact = sDesc
End Function

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


Brian McDermott

unread,
Sep 8, 2003, 8:51:18 AM9/8/03
to
Thank you very much - I'll give it a go.


"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:3F58A68...@hydro.com...

0 new messages