尝试对 'BizTalk' 提供程序执行 InitializeDefaultDrives 操作失败

Attempting to perform the InitializeDefaultDrives operation on the 'BizTalk' provider failed

我遇到错误:

"Attempting to perform the InitializeDefaultDrives operation on the 'BizTalk' provider failed.".

几个月前,我在我们的 BizTalk Dev 系统上使用了它;今天刚刚安装了生产服务器,并收到错误。

在 Win 2012 上使用 BizTalk 2016。

我运行命令:

  %windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
 .\BizTalkFactory.PowerShell.Extensions.dll

并且我在 32 位模式下使用 PowerShell 4:

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Users\myusername> get-pssnapin -registered


Name        : BizTalkFactory.PowerShell.Extensions
PSVersion   : 4.0
Description : Windows PowerShell CmdLets and Provider for Microsoft Biztalk Server

Name        : WDeploySnapin3.0
PSVersion   : 2.0
Description : This is a PowerShell snap-in that contains cmdlets for managing Microsoft Web Deployment infrastructure.



PS C:\Users\myusername> Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions
Attempting to perform the InitializeDefaultDrives operation on the 'BizTalk' provider failed.
PS C:\Users\myusername> Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions
PS C:\Users\myusername> Get-ExecutionPolicy
RemoteSigned

在我的开发环境中,BizTalk 和 SQL 在同一台服务器上,但在生产环境中,它们在不同的服务器上。

显然,如果在不同的服务器上,您必须添加这一行:

New-PSDrive -Name BizTalk -Root BizTalk:\ -PsProvider BizTalk -Instance MySqlServer -Database BizTalkMgmtDb

只需将 "MySqlServer" 替换为您的服务器名称即可。

在此处获得 idea/solution:Installing the BizTalkFactory PowerShell Provider on BizTalk 2013,他在其中谈到了创建 Profile.ps1 文件。或者我可能在 Dev 中创建了那个 Profile.ps1,然后就忘了它;现在检查一下。

如果有人偶然发现这个旧的post,要停止错误,只需事先设置这个变量:

$InitializeDefaultBTSDrive = $false

它也使它更快。

添加管理单元的替代方法是只导入模块,因此您的脚本变为:

$InitializeDefaultBTSDrive = $false
Import-Module "$env:BTSINSTALLPATH\SDK\Utilities\PowerShell\BizTalkFactory.PowerShell.Extensions.dll" -WarningAction Ignore
New-PSDrive -Name BizTalk -PSProvider BizTalk -Root BizTalk:\ -Instance mybiztalksqlservername.mydomain -Database BizTalkMgmtDb