简体   繁体   English

将-ea与Add-PSSnapin一起使用时Powershell停止工作

[英]Powershell stops working when using -ea with Add-PSSnapin

i just encountered this strange behaviour: 我刚遇到这种奇怪的行为:

The following line causes powershell to stop working: 以下行导致powershell停止工作:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -Erroraction Silentlycontinue

while the following works fine: 虽然以下工作正常:

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

This is the problem signature found in the Eventviewer: 这是在Eventviewer中找到的问题签名:

P1: powershell.exe P1:powershell.exe

P2: 6.3.9600.17090 P2:6.3.900.17090

P3: System.NullReferenceException P3:System.NullReferenceException

P4: System.TypeInitializationException P4:System.TypeInitializationException

P5: unknown P5:未知

P6: oft.Exchange.Diagnostics.SystemTraceControl.Update P6:oft.Exchange.Diagnostics.SystemTraceControl.Update

P7: unknown P7:未知

Does anyone have a clue why this happens? 有谁知道为什么会这样吗? The system runs on Server 2012R2 系统在Server 2012R2上运行

Thanks in advance 提前致谢

I had this exact issue on Server 2012 R2. 我在Server 2012 R2上遇到了这个确切的问题。 I was able to get it working by leveraging the -name argument. 我可以通过使用-name参数来使其工作。

Add-PSSnapin -name "Microsoft.Exchange.Management.PowerShell.E2010"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从C#运行PowerShell脚本时,Add-PSSnapin的路径不正确 - Path for Add-PSSnapin not correct when running PowerShell Script from C# Powershell错误Add-PSSnapin“ Microsoft.SharePoint.PowerShell” - Powershell error Add-PSSnapin “Microsoft.SharePoint.PowerShell” 来自高级(cmdlet)函数的PowerShell Add-PSSnapIn - PowerShell Add-PSSnapIn from an advanced (cmdlet) function Linux Powershell客户端:Add-PSSnapin VeeamPSSnapIn和Connect-VBRServer - Linux Powershell client : Add-PSSnapin VeeamPSSnapIn & Connect-VBRServer Powershell Add-PSSnapin VMWare.VimAutomation.Core问题 - Powershell Add-PSSnapin VMWare.VimAutomation.Core issues Add-PSSnapin Windows 10 - Add-PSSnapin Windows 10 无法将pssnapin microsoft.exchange.management.powershell.admin添加到Powershell Studio脚本 - Unable to add-pssnapin microsoft.exchange.management.powershell.admin to powershell studio script Windows7中的Add-PsSnapin WebAdministration - Add-PsSnapin WebAdministration in Windows7 使用 foreach-parallel 在运行空间中添加 PSsnapin - Add-PSsnapin in runspace with foreach-parallel Add-PSSnapin'Microsoft.SharePoint.PowerShell'在ISE中运行,但不是从.Net Process.Start命令运行 - Add-PSSnapin 'Microsoft.SharePoint.PowerShell' runs in ISE but not from .Net Process.Start command
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM