Can anyone tel me if there is a way to enumerate system drivers and
their state against a list of remote computers? This would be the same
information you see when running WINMSD on a server. I am looking for
the existence of a particular driver and whether it is loaded and
running. I believe I can utilize the driverquery command and then
parse that but I was hoping for some method using only vbscript and/or
WMI. Thank you.

Re: Enumerating System Drivers by Pegasus

Pegasus
Fri May 02 10:22:53 CDT 2008


"Jim Gregg" <crazytek@gmail.com> wrote in message
news:47b05f85-ea09-474a-af66-7425997e2244@56g2000hsm.googlegroups.com...
> Can anyone tel me if there is a way to enumerate system drivers and
> their state against a list of remote computers? This would be the same
> information you see when running WINMSD on a server. I am looking for
> the existence of a particular driver and whether it is loaded and
> running. I believe I can utilize the driverquery command and then
> parse that but I was hoping for some method using only vbscript and/or
> WMI. Thank you.

If you mean "service" when you say "driver" then sc.exe would
be a good tool to use.



RE: Enumerating System Drivers by urkec

urkec
Fri May 02 11:38:00 CDT 2008

"Jim Gregg" wrote:

> Can anyone tel me if there is a way to enumerate system drivers and
> their state against a list of remote computers? This would be the same
> information you see when running WINMSD on a server. I am looking for
> the existence of a particular driver and whether it is loaded and
> running. I believe I can utilize the driverquery command and then
> parse that but I was hoping for some method using only vbscript and/or
> WMI. Thank you.
>


There is Win32_SystemDriver class. This script lists all instances on a
local computer:

strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")

Set colSysDrivers = objWMIService.ExecQuery _
("Select * From Win32_SystemDriver")

For Each objSysDriver In colSysDrivers

WScript.Echo "Name: " & objSysDriver.Name
WScript.Echo "Description: " & objSysDriver.Description
WScript.Echo "File: " & objSysDriver.PathName
WScript.Echo "Type: " & objSysDriver.ServiceType
WScript.Echo "Started: " & CStr(objSysDriver.Started)
WScript.Echo "Start mode: " & objSysDriver.StartMode
WScript.Echo "State: " & objSysDriver.State
WScript.Echo "Status: " & objSysDriver.Status
WScript.Echo "Error control: " & objSysDriver.ErrorControl
WScript.Echo "Accept pause: " & CStr(objSysDriver.AcceptPause)
WScript.Echo "Accept stop: " & CStr(objSysDriver.AcceptStop)
WScript.Echo

Next


If you need to query multiple computers you can put the list in an array or
read it from a file. You can specify the driver name in the query:

strDriverName = "tcpip"
arrComputers = Array("computer1", "computer2", "computer3")

For Each strComputer In arrComputers

Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")

Set colSysDrivers = objWMIService.ExecQuery _
("Select * From Win32_SystemDriver " _
& "Where Name = '" & strDriverName & "'")

WScript.Echo "Instance count: " & colSysDrivers.Count
WScript.Echo

For Each objSysDriver In colSysDrivers

WScript.Echo "Name: " & objSysDriver.Name
WScript.Echo "Description: " & objSysDriver.Description
WScript.Echo "File: " & objSysDriver.PathName
WScript.Echo "Type: " & objSysDriver.ServiceType
WScript.Echo "Started: " & CStr(objSysDriver.Started)
WScript.Echo "Start mode: " & objSysDriver.StartMode
WScript.Echo "State: " & objSysDriver.State
WScript.Echo "Status: " & objSysDriver.Status
WScript.Echo "Error control: " & objSysDriver.ErrorControl
WScript.Echo "Accept pause: " & CStr(objSysDriver.AcceptPause)
WScript.Echo "Accept stop: " & CStr(objSysDriver.AcceptStop)

Next

Next




--
urkec

Re: Enumerating System Drivers by Jim

Jim
Fri May 02 12:33:42 CDT 2008

On May 2, 12:38=A0pm, urkec <ur...@discussions.microsoft.com> wrote:
> "Jim Gregg" wrote:
> > Can anyone tel me if there is a way to enumerate system drivers and
> > their state against a list of remote computers? This would be the same
> > information you see when running WINMSD on a server. I am looking for
> > the existence of a particular driver and whether it is loaded and
> > running. I believe I can utilize the driverquery command and then
> > parse that but I was hoping for some method using only vbscript and/or
> > WMI. Thank you.
>
> There is Win32_SystemDriver class. This script lists all instances on a
> local computer:
>
> strComputer =3D "."
> Set objWMIService =3D GetObject _
> ("winmgmts:\\" & strComputer & "\root\cimv2")
>
> Set colSysDrivers =3D objWMIService.ExecQuery _
> ("Select * From Win32_SystemDriver")
>
> For Each objSysDriver In colSysDrivers
>
> WScript.Echo "Name: " & objSysDriver.Name
> WScript.Echo "Description: " & objSysDriver.Description
> WScript.Echo "File: " & objSysDriver.PathName
> WScript.Echo "Type: " & objSysDriver.ServiceType
> WScript.Echo "Started: " & CStr(objSysDriver.Started)
> WScript.Echo "Start mode: " & objSysDriver.StartMode
> WScript.Echo "State: " & objSysDriver.State
> WScript.Echo "Status: " & objSysDriver.Status
> WScript.Echo "Error control: " & objSysDriver.ErrorControl
> WScript.Echo "Accept pause: " & CStr(objSysDriver.AcceptPause)
> WScript.Echo "Accept stop: " & CStr(objSysDriver.AcceptStop)
> WScript.Echo
>
> Next
>
> If you need to query multiple computers you can put the list in an array o=
r
> read it from a file. You can specify the driver name in the query:
>
> strDriverName =3D "tcpip"
> arrComputers =3D Array("computer1", "computer2", "computer3")
>
> For Each strComputer In arrComputers
>
> Set objWMIService =3D GetObject _
> ("winmgmts:\\" & strComputer & "\root\cimv2")
>
> Set colSysDrivers =3D objWMIService.ExecQuery _
> ("Select * From Win32_SystemDriver " _
> & "Where Name =3D '" & strDriverName & "'")
>
> WScript.Echo "Instance count: " & colSysDrivers.Count
> WScript.Echo
>
> For Each objSysDriver In colSysDrivers
>
> WScript.Echo "Name: " & objSysDriver.Name
> WScript.Echo "Description: " & objSysDriver.Description
> WScript.Echo "File: " & objSysDriver.PathName
> WScript.Echo "Type: " & objSysDriver.ServiceType
> WScript.Echo "Started: " & CStr(objSysDriver.Started)
> WScript.Echo "Start mode: " & objSysDriver.StartMode
> WScript.Echo "State: " & objSysDriver.State
> WScript.Echo "Status: " & objSysDriver.Status
> WScript.Echo "Error control: " & objSysDriver.ErrorControl
> WScript.Echo "Accept pause: " & CStr(objSysDriver.AcceptPause)
> WScript.Echo "Accept stop: " & CStr(objSysDriver.AcceptStop)
>
> Next
>
> Next
>
> --
> urkec

That is exactly what I needed. Thank you.