Remote USB Device
-
Friday, November 23, 2012 2:59 PM
I have script and want remotely detect usb ports on a remote box via ip on a thinclient that uses linux
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDevices = objWMIService.ExecQuery _
("Select * From Win32_USBControllerDevice")
For Each objDevice in colDevices
strDeviceName = objDevice.Dependent
strQuotes = Chr(34)
strDeviceName = Replace(strDeviceName, strQuotes, "")
arrDeviceNames = Split(strDeviceName, "=")
strDeviceName = arrDeviceNames(1)
Set colUSBDevices = objWMIService.ExecQuery _
("Select * From Win32_PnPEntity Where DeviceID = '" & strDeviceName & "'")
For Each objUSBDevice in colUSBDevices
Wscript.Echo objUSBDevice.Description
Next
Next- Edited by NightWing 2099 Friday, November 23, 2012 2:59 PM
All Replies
-
Friday, November 23, 2012 3:11 PMModerator
Hi,
First, in order to query a Linux machine with WMI, you would need to install a WMI client on the Linux machine. Second, this is not a Linux forum, so you're not asking in the right place; sorry.
Bill
- Marked As Answer by NightWing 2099 Friday, November 23, 2012 3:16 PM
-
Friday, November 23, 2012 5:25 PM
Hi,
First, in order to query a Linux machine with WMI, you would need to install a WMI client on the Linux machine. Second, this is not a Linux forum, so you're not asking in the right place; sorry.
Bill
Bill - it is possible to query a CIM client ona a linux machine and it is done regularly. Teh Win32_Classes do not exist and the namespaces and calsses will be different. Teh authentication method wouould need to be lknown.
I recommend looking into Linux CIM for more information. Linux forums would be more helpful.
Start here: http://openwbem.sourceforge.net/
With thin clients the usual method for querying hardware is to use SNMP. WMI can query SNMP data in some cases. SNMP is almost always unstalled and enabled. CIM/WBEM is not always enabled.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Friday, November 23, 2012 5:29 PM
-
Friday, November 23, 2012 5:30 PMModerator
Bill - it is possible to query a CIM client ona a linux machine and it is done regularly.
Yes. This is what I meant when I wrote "you would need to install a WMI client on the Linux machine." (Obviously implied: "You would not need to install a WMI client on the Linux machine if it's already got one.")
Bill
-
Friday, November 23, 2012 6:37 PM
Bill - it is possible to query a CIM client ona a linux machine and it is done regularly.
Yes. This is what I meant when I wrote "you would need to install a WMI client on the Linux machine." (Obviously implied: "You would not need to install a WMI client on the Linux machine if it's already got one.")
Bill
Let's get out terminology straight or searching will not turn up the correct answers or any answer at all.
A Linux thin client cannot run WMI a qa client or a service. It has support for CIM and SNMP. If CIM (or CIMOM) is enabled it can be queried from a Windows WMI client however only the CIM and other Linux specific calsses will exisit. WIn32 classes are propriewtary to Microsoft WIndows.
WMI is an implementation of the industry standard WBEM specification (see link above). If you know the account,password and authientication scheme of teh Linux CIM instance you can connect using WMI just like we connect to Windows machines. Seqarch for your flavor of Linux/CIM and you will find many examples that will get you started.
With PowerSHell 3.0 we now have a nearly pure implementation of CIM with teh new CIM CmdLets. This is designed to make it easier to conenct to non-WIndows systems and in preparation for the newest release of the desktop and device management standards.
CIM: http://dmtf.org/standards/cim
OMI: http://blogs.msdn.com/b/wmi/archive/2012/07/02/announcing-omi-open-management-infrastructure.aspx
OMI is OpenMangement Infrastructure and is the new standrds based replacement for WMI as it is standard across the industry. WMI/WBEM will be able to query teh same calsses across all architectures and vendors as well as query mobile devices, pronters, scanner and any device that wishes to implement CIM/OMI even you mother's refrigerator.
¯\_(ツ)_/¯
-
Friday, November 23, 2012 7:02 PMModerator
*Sigh*
OK, s/WMI/CIM/g
Bill
-
Friday, November 23, 2012 7:23 PM
Now everyone is going to ask question about how to query Linux with WMI.
Get PowerSHell 3 and make it easy.
¯\_(ツ)_/¯

