How to code it using Powershell Script?

This topic contains 1 reply, has 2 voices, and was last updated by  postanote 4 months ago.

  • Author
  • #91853


    I would like to know on how to login using PowerShell, and what wrong is following coding?

    Does anyone have any suggestions?
    Thanks in advance for any suggestions

    HTML Coding

    #E-Mail *
    #Password *


    PowerShell Script
    $clnt = new-object System.Net.WebClient
    $URL = ""
    $token = "aaabbbcccjfheh48u8jdjd"
    $username = "sample_username"
    $password = "sample_password"
    $postParams = @{FORM_TOKEN=$token; LoginForm_email=$username; LoginForm_password=$password}
    Invoke-WebRequest -URi $URL -Method POST -body $postParams

  • #91907


    What you are doing and asking about is s very common thing. You just have to make sure you are calling the objects of the fomr correctly.

    There are lots of examples of how to do this all over the web.

    For example:

    There are direct examples in the PoSH built-in help files ...

        # Get parameters, examples, full and Online help for a cmdlet or function
        (Get-Command -Name Invoke-WebRequest).Parameters
        Get-help -Name Invoke-WebRequest -Examples
        Get-help -Name Invoke-WebRequest -Full
        Get-help -Name Invoke-WebRequest -Online

    ... and sample scripts provide via the MS and the Scripting Guys blog.

    Automate login to website
    A script to log in to a website, parse the contents into objects, click some buttons and tick some checkboxes.

You must be logged in to reply to this topic.