Author Posts

March 28, 2016 at 9:02 am

hello, i need a script that resets my portforward everytime i restart my pc (i dont know why but everytime my pc restarts the portforward resets)
this is my logon script

$username = "ziggo"
$password = "draadloos"
$router = "192.168.178.1"
$ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.Navigate($router)
while($ie.ReadyState -ne 4) {start-sleep -m 100}
start-sleep -s 3

$ie.Document.getElementsByName('loginUsername').value = '$username'

$ie.Document.getElementsByName('Password').value = '$password'

$ie.Document.getElementsByName('submit').click()

i changed getElementsByName part to nearly everything i can come up with, no succes

logon site html: https://www.dropbox.com/s/zlak6auqbdey5lb/view-source_192.168.178.1.html?dl=0

March 28, 2016 at 10:46 am

You're using single quotation marks. That means $username and $password will be passed as literals. If you use double quotes, the variables will be replaced with their contents.

March 29, 2016 at 9:42 am

didnt really matter since it didnt even fill it in, but thanks anyways.
heres a screenshot of powershell (too lazy to cut out rest, sorry)
https://www.dropbox.com/s/m5fjhyhx8pg3ext/screenshot.png?dl=0
and yes i edited 'loginusername' with double quotes, still no success