2015-02-05 227 views
1

我正在尝试自动安装SharePoint 2013,为此我必须安装PowerShell的MSI文件,但执行它时会返回错误。使用PowerShell v3.0安装msi文件

这是错误消息:

Error: This command cannot be run due to the error: No application is associated with the specified file for this operation.

这里是我想执行的命令..

Start-Process -FilePath C:\SharePoint_V2\SQL Shared Features\SQLSysClrTypes.msi -ArgumentList /qn /quiet /norestart /l* C:\temp\SQLCLR.log -WorkingDirectory C:\SharePoint_V2\SQL Shared Features\ -verb runAs -Wait; 

这是我试过/检查:

  • 我可以手动安装msi(所以有一个与指定文件关联的应用程序)
  • 打开一个msi文件的默认程序设置为Windows安装程序
  • 脚本已经以管理员身份运行

我一直在寻找了几个小时了一个解决方案,我的想法。

回答

2

我会直接调用msiexec并在参数列表中包含/ I-switch(这是我而不是L)。 (在命令行上检查msiexec /?以获得完整选项)

对于您的情况,它将如下面的示例一样。请注意围绕完整参数列表的双引号。

Start-Process -FilePath "C:\Windows\System32\msiexec.exe" -ArgumentList "/I C:\SharePoint_V2\SQL Shared Features\SQLSysClrTypes.msi /qn /quiet /norestart /l* C:\temp\SQLCLR.log" -WorkingDirectory C:\SharePoint_V2\SQL Shared Features\ -verb runAs -Wait; 
+0

谢谢。通过一些调整,我能够使其工作。由于我试图在启动过程中连接,因此我仍然有一些错误。 最终结果: 'Start-Process -FilePath“C:\ Windows \ System32 \ msiexec.exe”-ArgumentList $ SQLCLRArgumentList -WorkingDirectory $ SharedFeaturesPath -verb runAs -Wait; – KePa 2015-02-05 13:42:32