Используйте форму HTML как GUI для powershell
Код ниже работает нормально, однако я получаю сообщение об ошибке при его использовании на Azure VM
============= Ошибка =============
Error-
The property 'innerHTML' cannot be found on this object. Verify that the
property exists and can be set.
At line:24 char:1
+ $ie.document.body.innerHTML = $html
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
***
============= ==== Код =================
$html = @"
<HTML>
<body>
<form>
First name: <input type="text" id="firstname">
<br>
Last name: <input type="text" id="lastname">
<br>
<input type="hidden" name="finished" value="0">
<input type="button" id="button" value="Continue"onclick="finished.value=1">
</form>
</body>
</html>
"@
$ie = new-object -com "InternetExplorer.Application"
$ie.navigate2("about:blank")
$ie.AddressBar = $false
$ie.MenuBar = $false
$ie.StatusBar = $false
$ie.document.body.innerHTML = $html
$ie.Visible = $true
$doc = $ie.document
while ($doc.getElementByID("finished").value -ne 1) {
start-sleep -m 500
}
$ie.Visible = $false
"You answered:"
$doc.getElementByID("firstname").value
$doc.getElementByID("lastname").value
$ie.quit()