How to connect secure web page with Powershell?

You can connect to secure web pages with powershell using your username and password.

1
2
3
4
5
6
7
$url = "http://secure.yusufozturk.info/secured_page.aspx"
$username = "ysfozy"
$pass = "my_password"
$domain = "DOMAIN"
$webclient = new-object System.Net.WebClient
$webclient.Credentials = new-object System.Net.NetworkCredential($username, $pass, $domain)
$webpage = $webclient.DownloadString($url)

Simply use write-host to see contents of the web page.

Tags: , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

4 Responses to “How to connect secure web page with Powershell?”

  1. Hi Yusuf
    I am new to Powershell and am trying to make your script work for me. I’ve tried to use write-host to write the content to the screen but it’s not working. Can you give me a little more guidance on how to make the web page write to the screen? Thanks.

  2. Hello Randy,
    Did you try “write-host $webpage” to see contents? Also I posted a new article about how to parse a webpage and see specific parts of the web page. You can reach post from here:
    http://www.yusufozturk.info/powershell/how-to-parse-a-web-page-and-find-a-specific-info-with-powershell.html

  3. Ahh. Such a easy mistake. Thank you for your help. Your examples are really awesome.

  4. You are welcome :)

Leave a Reply