Hello. Aim to reboot modem. My actions:

I go to the web interface of the modem.

$ie = new-object -com "InternetExplorer.Application" $ie.navigate("http://11.11.11.11/login.html") $ie.visible = $true $doc = $ie.document $tb1 = $doc.getElementByID("username") $tb2 = $doc.getElementByID("password") $btn = $doc.getElementByID("login") $tb1.value = "admin" $tb2.value = "password" $btn.click() 

There is a plug. I can not imitate clicking on the link. Tell me how to do this?

Link: a onclick="ExpandMenu('admin');" href="#"> a onclick="ExpandMenu('admin');" href="#">

How else to press the button:

 input type="button" onclick="DoReBoot();" value="Перезагрузить уст-во" style="width: 180px;"> 

Just starting to learn PowerShell . Therefore, not everything works out. Did he explain clearly?)

  • Isn't it easier to reboot the modem via telnet ? In the command line, write telnet 192.168.1.1 , log in under the admin account and execute the reboot command. The procedure may differ for different modems, look in Google for an algorithm for your particular model. - fori1ton
  • @ fori1ton, Well, actually, as a rule, telnet access to routers and other devices is now closed, and they are considered not secure. - pincher1519

1 answer 1

Click on the link as follows:

 $myLink = $ie.Document.getElementsByTagName('a') | where-object {$_.innerText -eq 'Имя ссылки'} $myLink.click() 

You can press the button using powershell like this:

 $myBtn=$ie.Document.getElementsByTagName("input") | where-object {$_.type -eq "button"} $myBtn.click();