我已创建示例cmdlet作为file.ps1,其逻辑用于在所需时间迭代检查我的新收件箱电子邮件。但是当OS Task调度程序(Windows 7)执行它时,我得到了这些错误:
The interface is unknown. (Exception from HRESULT: 0x800706B5)At
C:\SCRIPTS\my-userAgent.ps1:7 char:7
+ while($ie.busy -eq $true)
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Method invocation failed because [System.__ComObject] does not contain a
method named 'Navigate'.At C:\SCRIPTS\my-userAgent.ps1:18 char:2
+ $ie.Navigate($url)
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Navigate:String) [], RuntimeE
xception
+ FullyQualifiedErrorId : MethodNotFound
据我所知,它们是由我的COM_obj引起的,但是为什么当我从 PowerShell_ISE 执行相同的脚本时,它会通过并正常工作!?!我试图解决它:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process
希望与user_privileges相关,但到目前为止还没有成功。