Solved

Powershell - sign into a website and check status?

Posted on 2014-11-07
4
178 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 69

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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.
Synchronize a new Active Directory domain with an existing Office 365 tenant
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

805 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