PowerShell : Control IE
Voici quelques bouts de code PowerShell permettant le control d’Internet Explorer
#Rune IE
$ie = new-object -com "InternetExplorer.Application"
$ie.visible = $true
$ie.navigate('http://mypage.com')
#Authentication on the web page
while($ie.busy) {start-sleep 1}
if ($ie.document.getElementByID("FormUsername") -ne $null)
{
$ie.document.getElementByID("FormUsername").value = "myLogin"
$ie.document.getElementByID("FormPassword").value = "MyPwd"
#Click on the button for logon
$forms = @($ie.Document.forms | where {$_.action -match "VerifPwd.htm"})
$forms[0].submit()
while($ie.busy) {start-sleep 1}
}
$ie.navigate('http://mypage.com/page2.html')
while($ie.busy) {start-sleep 1}
#Exit IE
$ie.quit()
