Willing2Learn_More
asked on
VB Script to verify video driver version and then update if it's not correct
Hello,
I am trying to create a vbscript that would check the video driver version and then update the driver if it is not the correct version. I have a few different machine models and various display adapters. It will need to verify the hardware and driver version then install the correct driver unattended. Below is the vbs that I started which will identify the video driver version and model. Where I am stuck is how to get the script to use the info to verify and then carry out the install. I also need to ensure the event is captured in the event viewer which I believe is almost complete but not sure if a failure is recorded. Can someone please help with reviewing this to see what I am missing. I can't seem to figure out how to get it to verify then install from a network location. Also how to handle other models? Do I just cut and paste the process and change the else command?
Sorry - please bear with me - but I am pretty new to vbscript and I still have ALOT to learn as you will see..Honestly, I am truly amazed I even got this far on my own. I am open to suggestions. Many Thanks!
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_VideoController")
For Each objItem in colItems
For Each strCapability in objItem.AcceleratorCapabil ities
Wscript.Echo "Accelerator Capability: " & strCapability
Next
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Driver Date: " & objItem.DriverDate
Wscript.Echo "Driver Version: " & objItem.DriverVersion
Wscript.Echo "INF Filename: " & objItem.InfFilename
Wscript.Echo "Installed Display Drivers: " & _
objItem.InstalledDisplayDr ivers
Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("S ELECT * FROM Win32_ComputerSystem")
For Each objItem In colItems
WScript.Echo "Manufacturer: " & objItem.Manufacturer
WScript.Echo "Model: " & objItem.Model
Next
Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscr ipt.Shell" )
objShell.LogEvent EVENT_SUCCESS, _
"Video Driver Update Successfully Installed by IT."
Next
If driver version Is Not 8.15.10.2321 And the model =nvidia Then install (\\server\data\files\drive rs\nvidia\ setup.msi /qn)
Else End
I am trying to create a vbscript that would check the video driver version and then update the driver if it is not the correct version. I have a few different machine models and various display adapters. It will need to verify the hardware and driver version then install the correct driver unattended. Below is the vbs that I started which will identify the video driver version and model. Where I am stuck is how to get the script to use the info to verify and then carry out the install. I also need to ensure the event is captured in the event viewer which I believe is almost complete but not sure if a failure is recorded. Can someone please help with reviewing this to see what I am missing. I can't seem to figure out how to get it to verify then install from a network location. Also how to handle other models? Do I just cut and paste the process and change the else command?
Sorry - please bear with me - but I am pretty new to vbscript and I still have ALOT to learn as you will see..Honestly, I am truly amazed I even got this far on my own. I am open to suggestions. Many Thanks!
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_VideoController")
For Each objItem in colItems
For Each strCapability in objItem.AcceleratorCapabil
Wscript.Echo "Accelerator Capability: " & strCapability
Next
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Driver Date: " & objItem.DriverDate
Wscript.Echo "Driver Version: " & objItem.DriverVersion
Wscript.Echo "INF Filename: " & objItem.InfFilename
Wscript.Echo "Installed Display Drivers: " & _
objItem.InstalledDisplayDr
Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("S
For Each objItem In colItems
WScript.Echo "Manufacturer: " & objItem.Manufacturer
WScript.Echo "Model: " & objItem.Model
Next
Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscr
objShell.LogEvent EVENT_SUCCESS, _
"Video Driver Update Successfully Installed by IT."
Next
If driver version Is Not 8.15.10.2321 And the model =nvidia Then install (\\server\data\files\drive
Else End
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER