Solved

Powershell - sign into a website and check status?

Posted on 2014-11-07
4
193 Views
Last Modified: 2014-11-13
Does anyone know how I can use powershell scripting to go to a URL and login to the website as a means of checking to see if the website login is working and the website is up?
I know it's probably tedious or complicated to post a full example here, but any minor examples or building block examples would be greatly appreciated.
0
Comment
Question by:garryshape
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

Accepted Solution

by:
becraig earned 250 total points
ID: 40429734
Here is a previously answered question that covered this:
http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_28379350.html
0
 

Author Comment

by:garryshape
ID: 40429976
Hmm not sure, the website I'm logging into is intranet and pops up with windows security login prompt, like a login box, so it wouldn't be a login form on a webpage
0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 250 total points
ID: 40430155
You can try if this works for you (assuming the following settings):
$url = 'http://server/site.html'
$usr = UserName
$pwd = PassWord

Open in new window

$wc = new-object System.Net.WebClient
$cc = new-object System.Net.CredentialCache
$cc.Add($url, 'Basic', (new-object System.Net.NetworkCredential($usr,$pwd)))
$wc.Credentials = $cc
$page = $wc.DownloadString($url)

Open in new window

or something like (requires PS4)
$cred = New-Object PsCredential($usr, (ConvertTo-SecureString $pwd -AsPlainText –force))
$page = Invoke-WebRequest -uri $url -Credentials $cred

Open in new window

0
 

Author Closing Comment

by:garryshape
ID: 40440769
aight tks dawgz
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question