Solved

Powershell - sign into a website and check status?

Posted on 2014-11-07
4
174 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
  • 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 68

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Set OWA language and time zone in Exchange for individuals, all users or per database.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now