I have a powershell script that I would like to run using an html form. All I have is a few form fields and a button. When I run my powershell script, it opens a new ie window
I add javascript by using the execScript("SCRIPT HERE","Type Of Script") of the parent window
$html = @"
"@
$ie = new-object -com "InternetExplorer.Application"
$ie.navigate("about:blank")
$ie.document.body.innerHTML = $html
$doc = $ie.Document
$doc.parentWindow.execScript("document.getElementById('finished').onclick = function(){document.getElementById('finished').value = 'Submitted';};","javascript")
$ie.Visible = $true
while ($doc.getElementByID("finished").value -ne "Submitted") {
start-sleep -m 500
$firstName = $doc.getElementByID("firstname").value
$lastName = $doc.getElementByID("lastname").value
}
$ie.Visible = $false
"You answered:"
$doc.getElementByID("firstname").value
$doc.getElementByID("lastname").value
$ie.quit()