powershell - 无法将dll添加到32位PowerShell

标签 powershell exchange-server-2007

我正在尝试为32位Powershell(Microsoft.Exchange.Management.PowerShell.Admin)添加Exchange 2007管理单元,但是在安装dll文件时似乎遇到了一些麻烦。

这些是我为了注册管理单元而运行的命令

PS C:\Program Files\Microsoft\Exchange Server\Bin> $snapinPath = 'Microsoft.Exchange.Management.PowerShell.Support.dll'
PS C:\Program Files\Microsoft\Exchange Server\Bin> C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /i $snapinPath

以上工作正常。然后,我使用以下命令安装主SnapIn:
PS C:\Program Files\Microsoft\Exchange Server\Bin> $snapinPath = 'Microsoft.Exchange.PowerShell.Configuration.dll'
PS C:\Program Files\Microsoft\Exchange Server\Bin> C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /i $snapinPath

Microsoft (R) .NET Framework Installation utility Version 2.0.50727.5483 Copyright (c) Microsoft Corporation. All rights reserved.

Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Exchange.PowerShell.Configuration, Version=8. 0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. An attempt was made to load a program with an incorrect format..



我不确定这里缺少什么。这是全新安装的Exchange 2007,因此不会损坏任何内容。

最佳答案

我的问题是我使用的是Microsoft.Exchange.PowerShell.Configuration.dll的64位版本。

我需要32位版本。由于不允许我安装32位版本,因此我提取了32位版本的Exchange的安装文件,并将setup \ serverroles \ common文件夹复制到C:\ Program Files \ Microsoft \ Exchange Server,然后将其重命名为Bin32。

最后阶段是复制此注册表项:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Exchange.Management.PowerShell.Admin



到以下位置:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\PowerShell\1\PowerShellSnapIns\Microsoft.Exchange.Management.PowerShell.Admin



然后更改键内的任何路径以指向新的Bin32文件夹。

此时,应该可以将Microsoft.Exchange.Management.Powershell.Admin管理单元加载到32位Powershell中(对于依赖于32位库的IIS应用程序非常有用)。

关于powershell - 无法将dll添加到32位PowerShell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30447530/

相关文章:

Powershell,foreach 的分页输出

session - 在不退出的情况下刷新/重新启动 PowerShell session

powershell - Tee-Object -变量未发送到标准输出

powershell - 如何从父进程向[Console]::In.ReadLine()发送输入?

c# - 托管的 PowerShell 在同一程序集中看不到 Cmdlet

exchange-server - 交换 : Is it possible to search for a custom Extended Property across all mailboxes?

java - JavaMail 和 Exchange Server 2007 的问题 - BAD 命令参数

java - EWS Java API 1.1 创建约会 - 缺少 TimeZoneDefinition

c# - EWS + 交换 2007 : Retrieve inline images

email - MS Exchange 服务器的 Grails 邮件插件配置