kizzle911 Posted November 9, 2008 Share Posted November 9, 2008 Does anyone know how to create a VBScript that will allow me to detect the Computer Model and then install the specific drivers for that Model PC?We have IBM T41,42,42,60,61 and HP Compaqs in our environment. I would like to have a script that would detect the model and install the audio, video, wireless, etc. drivers.Any help would be appreciated.Thanks. Link to comment Share on other sites More sharing options...
Yzöwl Posted November 9, 2008 Share Posted November 9, 2008 There are various ways of finding this information using WMI, although it can be found in different places depeding upon many factors.Try something like this:strComputer = inputbox("Type a computer name","Enter computer name")if strComputer = "" then strComputer = "."On Error Resume NextConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20WScript.EchoWScript.Echo "=========================================="WScript.Echo "Computer: " & strComputerWScript.Echo "=========================================="Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")Set colItems = objWMIService.ExecQuery("SELECT * FROM " _ & "Win32_ComputerSystem", "WQL", wbemFlagReturnImmediately _ + wbemFlagForwardOnly)For Each objItem In colItems WScript.Echo "Manufacturer: " & objItem.Manufacturer WScript.Echo "Model: " & objItem.ModelNextIf that doesn't produce results you could take a look at Win32_Baseboard and/or Win32_SystemEnclosure. Link to comment Share on other sites More sharing options...
kizzle911 Posted November 10, 2008 Author Share Posted November 10, 2008 Thanks for this script, it works great. However, how can I integrate this script so that it will allow me to detect a specific driver for that model PC.I am trying to set up runonce commands for our RIS setup and having a script that would detect the PC's and install driver specific to that model would be great.There are various ways of finding this information using WMI, although it can be found in different places depeding upon many factors.Try something like this:strComputer = inputbox("Type a computer name","Enter computer name")if strComputer = "" then strComputer = "."On Error Resume NextConst wbemFlagReturnImmediately = &h10Const wbemFlagForwardOnly = &h20WScript.EchoWScript.Echo "=========================================="WScript.Echo "Computer: " & strComputerWScript.Echo "=========================================="Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")Set colItems = objWMIService.ExecQuery("SELECT * FROM " _ & "Win32_ComputerSystem", "WQL", wbemFlagReturnImmediately _ + wbemFlagForwardOnly)For Each objItem In colItems WScript.Echo "Manufacturer: " & objItem.Manufacturer WScript.Echo "Model: " & objItem.ModelNextIf that doesn't produce results you could take a look at Win32_Baseboard and/or Win32_SystemEnclosure. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now