是否可以使用powershell登录https站点(安全http)

时间:2010-11-18 01:43:50

标签: powershell https

我之前在网站上自动登录过程,之前使用http但是相同的代码不适用于使用https(安全协议)的其他网站。所以我不确定我是否需要做一些额外的工作来使用PowerShell登录该网站。

编辑:添加评论代码


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

while ($ie.Busy -eq $true){Start-Sleep -Milliseconds 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") 

1 个答案:

答案 0 :(得分:0)

您需要在$ie.Navigate中加入“https”。我也相信如果您将$ie>传递给Get-Member,则可以使用Credentials属性来传递用户名和密码。我现在没有PowerShell在我面前,但之前使用https网站玩过这个。

相关问题