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

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS