28 thoughts on “Powershell : Automated Login to All your Websites in One Go.

  1. I did it.

    # Feed in your credentials to input fields on the web page
    $usernamefield = $ie.Document.getElementByID(‘login-usr’)
    $usernamefield.value = ‘xxxxxxx’
    $passwordfield = $ie.Document.getElementByID(‘login-pass’)
    $passwordfield.value = ‘xxxxxxx’
    #$Link=$ie.Document.getElementByID(‘signup-spotify’)
    $Link=$ie.Document.getElementsByTagName(“button”)
    Foreach ($btn2 In $Link)
    {
    if ($btn2.outerHTML -eq “Login”)
    {
    $btn2.Click()
    }
    else{
    }
    }

    Liked by 1 person

  2. Hi, What todo about below errors ?

    You cannot call a method on a null-valued expression.
    At C:\Users\43919773\Desktop\AUTO\25102016\one-connect.ps1:14 char:1
    + $usernamefield = $ie.Document.getElementByID(‘userid’)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

    Like

  3. Hi Prateek,

    can assist me in below —
    the requirement is as below

    1- Open multiple tab for all different Sites
    2- Remove security SSL
    3- Auto key user ID and Password
    4- Hit enter to get login
    5- from step 2-4 go one by one sites
    6- Close complete IE in every 5 min and reopen and steps 1-6

    Please assist and u may mail me at mukeshgupta23may@gmail.com

    Like

  4. Dear Pratik,
    I want to know that upto login it’s fine. After login, there is one button to be click and then have to click logoff. How can we script for these two?

    Like

  5. Hi there,

    Thanks for the post, it could potentially be very useful for me.

    I am struggling to find the Login button id at the below web page. Any chance you would know what it is? I can only see a class name. Can this be used? if so how is it referenced?

    https://viewer.leverton.de/login/auth

    Many thanks in advance.

    Like

  6. Hi

    I have a button my page which looks like this:

    How can I get this clicked?

    This is what I have tried but doesnt work:
    $Link2=$ie.Document.getElementsByTagName(“BUTTON”) | where-object {$_.class -eq “Download”}
    $Link2.click();;

    Thank you.

    Like

  7. Hey all,

    Just wanted to say, I recommend doing it using “Document.LocationURL -like “*facebook*” instead of LocationName.

    Reason being that the URL is (likely) never going to change, but small changes in the title/name provided by the code can occur on various sites.

    Thanks for the script above, it made completing a script I’ve been working on very easy, I didn’t realize I could pipe existing IE tabs into a new ComObject.

    Cheers!

    Liked by 1 person

  8. Hi Singh, my website source code doesn’t have “id” so I can’t seem to getElementbyId to work.
    The website I am trying to access has a “data-bind” call :

    How can I get your powershell script to work with these fields

    Thanks

    Like

  9. Hi Prateek – I would like my script to click on the Citrix Publish Application “My Production App”. However it not click on it.
    Here is the HTML Code:
    ==$0

    My Production App

    Here the code i’m trying to use:
    $Link = $ie.Document.getElementsByTagName(‘a’) |
    Where-Object { $_.ClassName -eq “My Production App” }
    Select-Object -First 1
    Any suggestions would be appreciated.

    Thanks

    Like

  10. Hi Prateek – I would like my script to click on the Citrix Publish Application “My Production App”. However it will not click on “My Production App”
    Here is the HTML Code below
    ==$0

    My Production App
    Here the code i’m trying to use:
    $Link = $ie.Document.getElementsByTagName(‘a’) |
    Where-Object { $_.ClassName -eq “My Production App” }
    Select-Object -First 1
    Any suggestions would be appreciated.

    Thanks

    Like

  11. I have a sight that once I log in and navigate around I must then click a link. This creates a new tab in internet explorer and appears to open as active. However when I use this bit of code $IE = (New-Object -COM “Shell.Application”).Windows() | ?{$_.locationname -like ‘*(tab name)*’}
    If($IE.Document -eq $null){ $IE.Refresh()}
    I get a null-valued expression error on the refresh line. I can not force the link to open in the current tab. Once I can resolve this issue I will have to navigate to another link and repeat the new tab process again before I can finally get to the page I need. Any help is appreciated. Thank you.

    Like

  12. […] » Visit Now Jun 07, 2015 · Powershell : Automated Login to All your Websites in One Go. … Is it possible that I can automate different set of email ID and password combination and run the script so that all can login in the website one by one. Thanks, Amit Prakash. Like Like. mukesh. February 25, 2017 at 7:37 pm Reply. […]

    Like

Leave a comment