Detect Monitor and Install Firware if Detected

Newbie apologies

I am trying to detect a monitor and if the monitor is present I wish to download and install firmware for the monitor. What I am thinking process would be like.

I need to run an If then with the following key
Get-WmiObject -Class win32_desktopmonitor
Specifically the Name to match LEN P24h-20

if it matches, then I would like to
Download this ISPTool_V3.7.4.5_Ver5–P24h-20_L2.0.zip

from https://download.lenovo.com/km/media/attachment/ISPTool_V3.7.4.5_Ver5--P24h-20_L2.0.zip

Then unzip the file.

Then Run \ISPTool_V3.7.4.5_Ver5–P24h-20_L2.0\ISPTool.exe from the path.

@hhramos Welcome to PowerShell.Org forums.

you have got the logic correct., Wow. Its just a matter of writing few more lines :-).

Get-WmiObject is obsolete and you may use Get-CimInstance with -Filter parameter where you can filter your monitor name.

$Requiredmonitor = Get-CimInstance -Class win32_desktopmonitor -Filter "Name = 'LEN P24h-20'"

Now you can use Invoke-WebRequest to download the file, do look at examples, especiall -OutFile parameter.

Invoke-WebRequest (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs

2 Likes

Thank you so much. I will give this a try.

This is what I have:
if ($Requiredmonitor = Get-CimInstance -Class win32_desktopmonitor -Filter “Name = ‘LEN P24h-20’”) {
‘The monitor connected is a lenovo P24h-20’

Source file location

$source = ‘https://download.lenovo.com/km/media/attachment/ISPTool_V3.7.4.5_Ver5--P24h-20_L2.0.zip

Destination to save the file

$destination = ‘c:\lenovomonitordownload\ISPTool_V3.7.4.5_Ver5–P24h-20_L2.0.zip’
#Download the file
Invoke-WebRequest -Uri $source -OutFile $destination

} Else {

‘The connected monitor is not a Lenovo P24h-20’

}