Advertisement
Guest User

Untitled

a guest
Nov 30th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. param(
  2. [string]$interval
  3. )
  4. function Refresh-WebPages {
  5. "Neptun refresh every $interval seconds."
  6. "press any key to exit."
  7. $shell = New-Object -ComObject Shell.Application
  8. do {
  9. Start-Sleep -Seconds $interval
  10. 'Refreshing'
  11. $shell.Windows() |
  12. Where-Object { $_.Document.url } |
  13. ForEach-Object { $_.Refresh() }
  14. } until ( [System.Console]::KeyAvailable )
  15. [System.Console]::ReadKey($true) | Out-Null
  16. }
  17. $username = "asd";
  18. $SecureString = Read-Host "password" -AsSecureString;
  19. $BSTR =
  20. [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString);
  21. $PlainPassword =
  22. [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
  23. $IE=new-object -com internetexplorer.application;
  24. $IE.navigate2("https://hallgato.neptun.elte.hu/login.aspx");
  25. $IE.visible=$true;
  26. While ($IE.Busy -eq $true) {Start-Sleep -Milliseconds 500}
  27. $IE.Document.getElementById('user').value = "$username";
  28. $IE.Document.getElementById('pwd').value = "$PlainPassword";
  29. ($IE.document.getElementById('btnSubmit') |select -first 1).click();
  30. Refresh-WebPages -interval
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement