我启动Powershell控制台的方式有什么区别? [英] What is the difference in the way I launch powershell console?

查看:278
本文介绍了我启动Powershell控制台的方式有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Sharepoint合作,我需要控制台主机中存在的Sharepoint管理单元.当我从Windows的开始"菜单运行powershell时,我运行命令

I work with Sharepoint and I need Sharepoint snap-in present in my console host. When I run powershell from my Windows start menu, I run command

Add-PSSnapin Microsoft.Sharepoint.Powershell

添加快照可以,一切正常.

snap-in is added ok, and everything works well.

此外,当我运行cmd.exe并键入powershell.exe并按Enter时,一切正常.因此,我认为此问题没有涉及任何快捷方式参数(但我不是100%确信:)).

Also, everything is ok, when I run cmd.exe, and type powershell.exe to it and press enter. So I think no shortcut parameters are involved in this problem (but I not 100% sure :) ).

但是,当我通过某些启动器启动Powershell时(我已经测试过 Launchy

But when I launch powershell through some launcher (I've tested Launchy and Enso) and I try to add the same snap-in, it fails with this error message:

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2.
At somefile.ps1:7 char:14
+     Add-PSSnapin <<<<  Microsoft.Sharepoint.Powershell
+ CategoryInfo          : InvalidArgument:(Microsoft.Sharepoint.Powershell:String)     
[Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : 
AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

当我使用启动器启动Powershell时有什么区别?

What is the difference when I launch powershell with launcher?

我认为这不是与共享点相关的问题,而是功能强大的问题.

I think this is not sharepoint related problem but rather powershell one.

(注意:我知道Sharepoint的管理外壳,但与此无关)

(note: I know about Sharepoint management shell and question is not about it)

推荐答案

不确定100%,但是PowerShell 32位和PowerShell 64位可能会出现问题.

No sure 100% but you may have a trouble with PowerShell 32 bits versus PowerShell 64 Bits.

例如,如果您的管理单元是64位,则只能与PowerShell 64位一起使用.如果 Launchy Enso 是32位,则它们将启动powerShell 32位,以查找32位SnapIn.另一面是同一回事.

For Example if your SnapIn is 64 bits, it can be only use with PowerShell 64 bits. If Launchy and Enso are 32 bits they starts powerShell 32 bits that look for a 32 bits SnapIn. It's the same thing in the other side.

通过64位进程,您可以使用以下命令强制使用PowerShell 64位:

From a 64 bits process, you can force using PowerShell 64 bits using :

c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe

通过64位进程,您可以使用以下命令强制使用PowerShell 32位:

From a 64 bits process, you can force using PowerShell 32 bits using :

c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe

通过32位进程,您可以使用(请阅读):

From a 32 bits process, you can force using PowerShell 64 bits using (Read this):

c:\windows\sysnative\WindowsPowerShell\v1.0\powershell.exe

这篇关于我启动Powershell控制台的方式有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆