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: authenticated web page, connecting secure webpages, powershell web content, Windows Powershell
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.
June 22nd, 2009 at 11:03 pm
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.
June 23rd, 2009 at 12:08 am
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
June 23rd, 2009 at 1:03 am
Ahh. Such a easy mistake. Thank you for your help. Your examples are really awesome.
June 23rd, 2009 at 1:30 am
You are welcome :)