复选框在 TCP/IP 设置中不起作用
Checkbox not working in TCP/IP settings
我一直在尝试让 powershell 选中打印机 TCP/IP 设置中的复选框,但无法使其正常工作。似乎在这些设置中出现的情况与盒子工作的其余部分不同。
input id="vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER"
name="vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER" value="1" type="checkbox" is the info in TCP/IP.
input name="2.system.17245" value="1" id="system.17245" checked="" type="checkbox"
是打印机其余部分的信息。下面是可以正常检查和取消检查的代码。
$adfbeep = $ie.Document.IHTMLDocument3_getElementByID("system.17245") | Where-Object {$_.type -eq "checkbox"}
$adfbeep.checked=$true
下面基本相同,但不起作用。不知道是不是因为name和id一样
$updttimeserver = $ie.Document.IHTMLDocument3_getElementByID("vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER") | Where-Object {$_.type -eq "checkbox"}
$updttimeserver.checked=$true
The property 'checked' cannot be found on this object. Verify that the property exists
and can be set.
At C:\Scripts\CX310 Config.ps1:132 char:1
+ $updttimeserver.checked=$true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
如有任何帮助,我们将不胜感激。对不起,如果它看起来有点过头了
我明白了。对于这些类型的复选框,它需要 IHTMLDocument3_getElementsByName("vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER")
而不是 IHTMLDocument3_getElementByID("vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER")
没有 vac.255 的复选框使用 getElementByID.
我一直在尝试让 powershell 选中打印机 TCP/IP 设置中的复选框,但无法使其正常工作。似乎在这些设置中出现的情况与盒子工作的其余部分不同。
input id="vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER"
name="vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER" value="1" type="checkbox" is the info in TCP/IP.
input name="2.system.17245" value="1" id="system.17245" checked="" type="checkbox"
是打印机其余部分的信息。下面是可以正常检查和取消检查的代码。
$adfbeep = $ie.Document.IHTMLDocument3_getElementByID("system.17245") | Where-Object {$_.type -eq "checkbox"}
$adfbeep.checked=$true
下面基本相同,但不起作用。不知道是不是因为name和id一样
$updttimeserver = $ie.Document.IHTMLDocument3_getElementByID("vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER") | Where-Object {$_.type -eq "checkbox"}
$updttimeserver.checked=$true
The property 'checked' cannot be found on this object. Verify that the property exists
and can be set.
At C:\Scripts\CX310 Config.ps1:132 char:1
+ $updttimeserver.checked=$true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
如有任何帮助,我们将不胜感激。对不起,如果它看起来有点过头了
我明白了。对于这些类型的复选框,它需要 IHTMLDocument3_getElementsByName("vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER")
而不是 IHTMLDocument3_getElementByID("vac.255.ALLOW_DHCP_TO_UPDATE_TIMESERVER")
没有 vac.255 的复选框使用 getElementByID.