Win 10 - Update Specific device driver with powershell script RRS feed

  • Question

  • Hello,

    im really sorry i think i am posting this in a wrong section but i can not find the powershell one... :(

    Long story Short i am looking for a method to update the driver of a specific device.

    Long Story:
    I have multiple computers with different graphics cards (devices).

    Here are the exact names:
    NVIDIA Quadro M2000 NVIDIA Quadro K5000 NVIDIA Quadro K4200 NVIDIA Quadro K1200 NVIDIA Quadro FX 3800 NVIDIA Quadro M4000

    which have old drivers that I want to update with a Powershell script. The newest drivers are in the Microsoft Catalog.

    I want to update a specific driver in my case the video card driver with a powershell script.

    How could I achieve this?

    My first attempt:

    Writing a script for multiple Cards which checks for already installed drivers and choses the first manually created inf files which is not included in the code yet and installs it but, I don't need that when there is the possibility to update a specific device from the Catalog.

    Here is a simple script to kinda get some information about the installed card:

    $KnownDevice =  “NVIDIA Quadro M2000”, "NVIDIA Quadro K5000", "NVIDIA Quadro K4200", "NVIDIA Quadro K1200", "NVIDIA Quadro FX 3800", "NVIDIA Quadro M4000"
    $Driver1 = “NVIDIA Quadro 2000”,  “NVIDIA Quadro 4000”
    $Driver2 = “NVIDIA Quadro M2000”,  “NVIDIA Quadro K5000”,"NVIDIA Quadro K4200", "NVIDIA Quadro K1200" , "NVIDIA Quadro M4000"
    $Driver3 = "NVIDIA Quadro FX 3800"
    $KnownDeviceVersion = "","","","","","",""
    Write-Output "Searching for existing graphic card driver"
    $graka = Get-WmiObject Win32_PnPSignedDriver| select devicename, driverversion, DeviceClass | where {$_.devicename -like "*Quadro*"}
    if ($None -eq $graka){
        Write-Host ('ERROR: No graphics card driver found') -Fore Red
        Write-Host ('Info for Admin') -Fore Red
        Write-Host ('Exiting Update') -Fore Red
        Start-Sleep -s 20
    }elseif(@($graka).length -gt 1 ){
        Write-Host('ERROR: Multiple Graphics card driver found. Call an Administrator for assistance')-Fore Red
        Write-Host('Info for Admin') -Fore Red
        Write-Host "Exiting Update"
        Start-Sleep -s 20
    Write-Host ('graphics card driver found') -Fore Green
    Write-Host "Installed graphics card" $graka.devicename -Fore Green
    Start-Sleep -s 5
    if (-Not ($KnownDevices.Contains($graka.devicename)))
        Write-Host('Installed Driver is not known - Call an Administrator for assistance') -Fore Red
        Write-Output "Info for Admin"
        Write-Output $graka
        Write-Output "Exiting Update"
        Start-Sleep -s 20
    Write-Host('Installed Driver is known') -Fore Green
    Write-Host('Checking Version...')

    Wednesday, August 19, 2020 1:44 PM