Retrieving domain information in Powershell

Here’s how to retrieve the current domain:

[reflection.assembly]::loadwithpartialname("System.DirectoryServices")
[System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain()

The result is a System.DirectoryServices.ActiveDirectory.Domain object:

Forest                  : i.activesolution.se
DomainControllers       : {ACTIVESERVER101.i.activesolution.se, ACTIVESERVER102.i.activesolution.se}
Children                : {}
DomainMode              : Windows2008R2Domain
Parent                  :
PdcRoleOwner            : ACTIVESERVER102.i.activesolution.se
RidRoleOwner            : ACTIVESERVER102.i.activesolution.se
InfrastructureRoleOwner : ACTIVESERVER102.i.activesolution.se
Name                    : i.activesolution.se

/Emil

Changing a solicit-response BizTalk send port into a one-way port

Sometimes you might have the need to change the type of an existing send port in BizTalk, e.g. from solicit-response to one-way. For example, when consuming a Wcf service using “Add generated items”, the binding files that are generated are for solicit-response send ports requiring you to handle the responses. If you don’t, you get the following error which is very unexpected if you’re not prepared:

The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted. Please use the Biztalk Administration console to troubleshoot this failure.

What the message says is that we have no subscriber to the response message of the Wcf request, and in many cases (one-way messages) we’re not interested in supplying one.

Modifying the send port to a one-way send port solves the problem, but as there’s no option for doing that in the BizTalk Administration Console we have to rely on a trick:

  1. export the bindings to file
  2. modify the file
  3. import the file back

Look here for the details, directly from the horse’s mouth (Microsoft):

http://msdn.microsoft.com/en-us/library/cc185524(v=bts.10).aspx

In case that link doesn’t work when you read this post (it’s been known to happen ;-)), here are the required modifications:

  1. Find the relevant SendPort in the binding file and change the value of IsTwoWay property to false.
    <SendPort Name="port_name" IsStatic="true" IsTwoWay="false" BindingOption="0">
  2. Comment out the ReceivePipeline and ReceivePipelineData elements inside the SendPort element.

That’s all. Importing the binding file back into BizTalk Administration Console should update the send port. If it doesn’t, try to delete the old port before importing the binding file.

In all, the above procedure is not all that complicated which makes you wonder why there is no option to do this directly in the administration console, doesn’t it? 🙂

/Emil