Разбор веб-страницы для текста - PullRequest
0 голосов
/ 22 января 2019

Я пытаюсь найти на веб-странице слово «Зеленый». Он говорит мне, что все в порядке, но если он находит «Красный», он говорит, что все плохо. То, что я сделал ниже, очень просто, но я думаю, этого достаточно, чтобы задать вопрос.

$web = Invoke-WebRequest http://myip/vrsinfo/aghealth/DISTAGAR
$web.ToString() -split "[`r`n]" | Select-String "Green"

Вот что возвращает

name="agSolarwindsHealth" value=Green readonly>

Вот что я пробовал до сих пор

if (name="agSolarwindsHealth" value=Green readonly>) {
    'This number is  1'
} else {
    'This number is  not 1'
}
Error
name=agSolarwindsHealth : The term 'name=agSolarwindsHealth' is not recognized
as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:3 char:5
+ if (name="agSolarwindsHealth" value=Green readonly>)
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (name=agSolarwindsHealth:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...