开发者

Is it possible to use powershell to logon https site (secure http)

I have previously automated login process on a website before which uses http however the same code is not working for another website which is using https (secure protocol). so i am not sure whether i have to do some extra work to logon that website using powershell.

EDIT: Adding code from comment


$ie = New-Object -ComObject "internetExplorer.Application" 
$ie.Visible = $true 
$ie.Navigate("secure.websitename.com/xyz/login.aspx";) 

while ($ie.Busy -eq $true){Start-Sleep -Millise开发者_运维技巧conds 1000;} 

Write-Host -ForegroundColor Magenta "Attempting to login"; 

$doc = $ie.Document 
$LoginName = $doc.getElementsByName("txtUserName") 

$LoginName.value = "username" 
$txtPassword = $doc.getElementsByName("txtUserPass")

$txtPassword = "password" 
$btnLogin = $doc.getElementsByName("cmdLogin") 


You will need to include the "https" in the $ie.Navigate. I also believe if you pipe $ie> to Get-Member there is a Credentials property that you can use to pass the username and password. I don't have PowerShell in front of me right now but have played with this before with a https site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜