how to do “If driver version is lower than x number” run c:\abc.exe

Welcome Forums General PowerShell Q&A how to do “If driver version is lower than x number” run c:\abc.exe

Viewing 2 reply threads
  • Author
    Posts
    • #280758
      Participant
      Topics: 3
      Replies: 3
      Points: 47
      Rank: Member

      Hi Guys

      Can someone please help me for the below issue:

      I need to install a network driver is the version is lower than the latest.

      I was doing this via reg location, but it seems the key is in different places on same models, I assume it’s how windows decides/ feels lol

      So I know how to get the driver version:

      Get-WmiObject Win32_PnPSignedDriver| select DeviceName, DriverVersion, Manufacturer | where {$_.DeviceName -like “Realtek RTL8822BE 802.11ac PCIe Adapter”}

      Can someone please help with what I need to do for if it is lower than eg 10.2.10 then run c:\abc.exe /s

      Thanks in advance

    • #280821
      Participant
      Topics: 4
      Replies: 424
      Points: 744
      Helping Hand
      Rank: Major Contributor

      You can get the driver version more efficiently by using a WMI Filter.  At the moment, you’re getting all of the drivers and then filtering them with Where-Object.

      By declaring the [System.Version] type you get objects that are easy to compare

      So then it’s just a case of doing the comparison:

      • This reply was modified 1 month ago by Matt Bloomfield. Reason: Formatting
      • This reply was modified 1 month ago by Matt Bloomfield. Reason: Formatting Again
    • #280872
      Participant
      Topics: 3
      Replies: 3
      Points: 47
      Rank: Member

      Thank you so much Matt.

      That’s exactly what I was in need of.

      Much appreciated.

      Have a great day buddy!

      Many thanks.

      Sunny.

Viewing 2 reply threads
  • You must be logged in to reply to this topic.