如何在没有用户交互的情况下安装 Microsoft Edge 扩展?

How can I install a Microsoft Edge extension without user interaction?

我目前正在开发将部署在企业环境中的 Microsoft Edge 扩展。

Edge 扩展目前已手动安装(并在每次浏览器重新启动时重新加载,因为它来自未知来源)。

对于 Internet Explorer 扩展,可以使用 RegAsm 在系统上注册 DLL,并且注册表调整允许加载所有加载项(IgnoreFrameApprovalCheck 键,请参阅 this link)而无需任何用户提示。

是否有类似的方法可以在无需用户交互的情况下自动将 Edge 扩展添加到浏览器?

谢谢!

至少到现在 (7/29/2016),安装 Microsoft Edge must be initiated and completed by the user 的扩展。但是,这个政策可能会在未来的版本中改变,我不确定。

All extensions for Microsoft Edge must be deployed from the Windows Store. The installation must be initiated and completed by the user, using only the user experience provided by Microsoft Edge and the Windows Store. Software may refer to the extension in the Windows Store, but may not change the experience of acquiring the extension, or otherwise apply undue influence or false pretenses to the user to make them install the extension.

我认为值得一试Add-AppxPackage。您将需要:

  • 打包扩展,使用所有目标机器都信任的证书签名。企业环境应该可以。
  • .ps1 安装脚本文件,也已签名。
  • Set-ExecutionPolicy 在所有目标机器上更改为 AllSigned 选项。

包应该被签名,否则 Add-AppxPackage 将无法工作。 Set-ExecutionPolicy 通常设置为 Restricted,这将阻止 ps1 文件来自 运行(并且 Add-AppxPackage 是仅限 PowerShell 的工具)——这就是为什么您需要强制 AllSigned 模式并签名你的脚本。还有无限制模式,但完全不推荐。

然后你写一个 .ps1 脚本,像

Add-AppxPackage Path\to\Your_extension.appx

并使用您选择的方法部署到目标机器上。 Here 您可以找到一些静默调用它的方法。

请注意,用户可能需要手动启用新安装的扩展程序。