BizTalk Server General - Creating a Host with WMI?

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > December 2004 > Creating a Host with WMI?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Creating a Host with WMI?
Neal Walters

2004-11-17, 5:48 pm

This page indicates that you can create a Host by using the MSBTS_Host WMI
Class:

http://msdn.microsoft.com/library/d...plorer_skmn.asp

We wrote the following code:

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\MicrosoftBizTalkServer:MSBTS_Host")
'set objConsumerClass = objWMIService.get(
Set Host = objWMIService.spawninstance_

'AuthTrusted : boolean AuthTrusted
Host.AuthTrusted=False

'Caption: CIM related
'Host.Caption =

'DecryptCertComment: Represents a comment field that allows you to associate
a friendly name with a decryption certificate
'Host.DecryptCertComment

'DecryptCertThumbprint: Contains the thumbprint of the public key
certificate used to decrypt inbound messages for this host.
'Host.DecryptCertThumbprint

'Description: Inherited from CIM_ManagedSystemElement
'Host.Description

'HostTracking: Boolean - Indicates whether instances of this BizTalk Host
will host the tracking sub service.
Host.HostTracking=False

'HostType: uint32 HostType - In-process = 1 / Isolated = 2
Host.HostType = 1

'InstallDate: Inherited from CIM_ManagedSystemElement
'Host.InstallDate

'IsDefault: boolean IsDefault / Indicates whether the BizTalk Host
represented by this WMI instance is the default BizTalk Host in the BizTalk
group.
Host.IsDefault=True

'LastUsedLogon: string LastUsedLogon / Contains the default logon for the
BizTalk Host instance creation user interface.
Host.LastUsedLogon = "OurDomain\OurUserid"

'MgmtDbNameOverride: RESERVED FOR FUTURE USE
' tried with and without this line present
Host.MgmtDbNameOverride = "BiztalkMgmtDb"

'MgmtDbServerOverride: RESERVED FOR FUTURE USE
' tried with and without this line present Host.MgmtDbServerOverride =
"BTTSTSRV01"

'Name: string Name / Contains the name of the host.
Host.Name = "TrackingHostGroup"

'NTGroupName: string NTGroupName / Contains the name of the Microsoft®
Windows® NT group
Host.NTGroupName = "OurDomain\Biztalk Tracking Host Users"

'Status: Status (Inherited from CIM_ManagedSystemElement)
'Host.Status

wscript.echo "About to put"

Host.put_

wscript.echo "After put"


Getting output (undocument error on the Host.put_ which is line 53):

About to put
D:\Odimo\BiztalkScripts\createhost2.vbs(53, 1) SWbemObjectEx: 0xC0C024BC


Don't we all love undocument errors? Nothing showed up on Google.
We tried on more than one computer and with "run as" super-admin
BiztalkAdmin security.

Thanks,
Neal Walters
http://Biztalk-Training.com - Free Biztalk Demos

Vladimir Pogrebinsky

2004-12-07, 8:46 pm

Use MSBTS_HostSetting WMI class instead.
Documentation is incorrect (I've opened a bug). It might be a good idea to
review BTSWMISchema.mof file. In many cases it has keywords like
SupportsCreate on WMI classes, so you can figure out what they are.

Regarding error handling from the WMI - it requires special care. Do
something like this:

Sub PrintWMIErrorThenExit(strErrDesc, ErrNum)
On Error Resume Next
Dim objWMIError : Set objWMIError =
CreateObject("WbemScripting.SwbemLastError")

If ( TypeName(objWMIError) = "Empty" ) Then
wscript.echo strErrDesc & " (HRESULT: " & Hex(ErrNum) & ")."
Else
wscript.echo objWMIError.Description & "(HRESULT: " & Hex(ErrNum) & ")."
Set objWMIError = nothing
End If

'bail out
wscript.quit 0
End Sub


--------------------[vbcol=seagreen]
WMI[vbcol=seagreen]
http://msdn.microsoft.com/library/d...-us/sdk/htm/ebi
z_prog_explorer_skmn.asp[vbcol=seagreen]
associate[vbcol=seagreen]
BizTalk[vbcol=seagreen]

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com