Powershell construct for mulitple values. Using the Invoke-WebRequest cmdlet.


hello, find $_.innerthtml -like "*brother* or "*hp*", when add "-or" operator, return value blank.

what better way write below snippet can lookup 2 or more values if exist where-object filter?

#####################################################

$site = read-host "enter printer ip"
$request = invoke-webrequest -uri $site
$request.allelements| where-object {$_.innerhtml -like "*brother*"}|
sort-object { $_.innerhtml.length } | select-object innertext -first 1



thanks!

$request.allelements| where-object {$_.innerhtml -like '*brother*' -or $_.innerhtml -like '*hp*'}|


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Generating Event ID 91, 44 with CA (In Event Viewer with source as Certsvc)

Group policy default policy cannot be edited because network name not found

Problem when changing update source