问题
I'm getting the error:
"Attempting to perform the InitializeDefaultDrives operation on the 'BizTalk' provider failed.".
I got this working on our BizTalk Dev system several months ago; just installed the Production server today, and getting the error.
Using BizTalk 2016 on Win 2012.
I ran the command:
%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe
.\BizTalkFactory.PowerShell.Extensions.dll
and I'm using PowerShell 4 in 32-bit mode:
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
回答1:
In my Development environment, BizTalk and SQL were on the same sever, but in Production environment, they are on different servers.
Apparently if on different servers, you have to add this line:
New-PSDrive -Name BizTalk -Root BizTalk:\ -PsProvider BizTalk -Instance MySqlServer -Database BizTalkMgmtDb
Just replace "MySqlServer" with your server name.
Got the idea/solution here: Installing the BizTalkFactory PowerShell Provider on BizTalk 2013, where he talks about creating a Profile.ps1 file. Or possibly I created that Profile.ps1 in Dev, and just forgot about it; checking on that now.
回答2:
In case anyone stumbles over this old post, to stop the error, just set this variable before hand:
$InitializeDefaultBTSDrive = $false
It also makes it a lot faster.
An alternative to adding the snapin is to just import the module, so your script becomes:
$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
来源:https://stackoverflow.com/questions/45089732/attempting-to-perform-the-initializedefaultdrives-operation-on-the-biztalk-pro