Solved

Powershell - sign into a website and check status?

Posted on 2014-11-07
4
169 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 28

Accepted Solution

by:
becraig earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
aight tks dawgz
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Set OWA language and time zone in Exchange for individuals, all users or per database.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 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

19 Experts available now in Live!

Get 1:1 Help Now