2016-08-05 50 views
0

我想通过PowerShell在基于Windows的Vagrant机器中安装Windows证书。通过PowerShell在Vagrant机器中安装Windows certiciate

我试图用这个命令

vagrant.exe powershell - c "Import-Certificate -Filepath C:\vagrant\Microcosm.cer" 

但我复活了一个错误

vagrant.exe : The machine with the name '-' was not found configured for 
At line:1 char:1 
+ vagrant.exe powershell - c "Import-Certificate -Filepath C:\vagrant\M ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+ CategoryInfo   : NotSpecified: (The machine wit... configured for:String) [], RemoteException 
+ FullyQualifiedErrorId : NativeCommandError 

this Vagrant environment. 

回答

0

是不是在你的命令一个错字?不应该是-c而不是- c(介意空格)后面的powershell动词。

+0

是的。但现在当我删除它时,我看到这个 'vagrant.exe:以下WinRM命令以非零退出状态响应。 在线:1 char:2 + vagrant.exe powershell -c“导入证书文件路径C:\ vagrant \ M ... + ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 〜' 还有更多我不能放在这个评论中的文字 –

+0

另外,也许我可以让你-CertStoreLocation,因为我需要在TrustedPublisher分支中使用这个证书,但是脚本应该怎么样呢? –

相关问题