• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 206
  • Last Modified:

Powershell - sign into a website and check status?

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
garryshape
Asked:
garryshape
  • 2
2 Solutions
 
becraigCommented:
Here is a previously answered question that covered this:
http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_28379350.html
0
 
garryshapeAuthor Commented:
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
 
QlemoC++ DeveloperCommented:
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
 
garryshapeAuthor Commented:
aight tks dawgz
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now