20 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s