简体   繁体   中英

new-item Host-Instance - BizTalk Powershell Extensions

I'm trying to use the Powershell Extensions to BizTalk 2010 to add a Host-Instance (the host already exists).

Add-PSSnapIn -Name BiztalkFactory.PowerShell.Extensions  #NOTE: Must be in 32-bit version of Powershellto use this SnapIn 
#get-PsSnapIn -registered   ### list registered Snap-In's 

$HostName = "TestNewHost"
$HostType = 1 # 1 = InProcess
$myNTHostGroupName = "BIZTALKDEV\Domain Users" 
$AuthTrusted = $false 
$domainName = "BizTalkDev" 
$serverName = "BizTalkDev"
$defaultAdminUser = "Administrator"

$hostCredentials = $Host.ui.PromptForCredential("Logon Credentials","This account must have SQL Server permissions.", $domainName + "\" + $defaultAdminUser, "");
[String]$hostCredentialsPassword = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($hostCredentials.Password)); 


#cd "Biztalk:\Platform Settings\Hosts"
#New-Item $HostName  -HostType:$HostType -NtGroupName:$NTGroupName -AuthTrusted:$AuthTruste
#New-Item -path $hostName -HostType:$HostType -NtGroupName:$NTGroupName -AuthTrusted:$AuthTrusted

cd "BizTalk:\Platform Settings\Host Instances"
dir
Write-Host "Try to add New HostInstance=$hostName"
New-Item $hostName -HostName $hostName -Credentials $hostCredentials -RunningServer $serverName 
dir

When I supply a valid domain user/password in the credentials, I get this error:

New-Item : Instance of the WMI class is not found. No instance was found with the specified key. This could be the result of the instance being deleted by another BizTalk Admin session.At E:\\CreateHost_PSSnapIn.ps1:27 char:1

If I leave off the -Credentials argument. It prompts me on that new-item for user/pass, and same error occurs. If I provide a totally bogus userid/pass, I still get the same error.

I found this issue. I had the wrong value for $servername, should have been "BizTalk2010Dev". I didn't catch that domain name and server name were different (this is a VM that a co-worker created).

So in summary, the error, while very ambiguous, was referring to the existing HostName being missing. All Host-Instances must be associated with an existing Host.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM