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

Azure MFA with Azure AD and RDS

Failed to setup initiator portal. Error status is given in the dump data.

Invalid pointer on gpresult /h gpreport.html