Wednesday, November 03, 2010

Certificate Management MA Troubleshooting

Working on a new CM MA at the moment, so of course am using PowerShell to verify connectivity from the Sync box to the CM box.  This is the quick little script that mimics what the CM MA does when it connects to the CM service:

###

### Load the CLM MA Proxy Assembly, and the .NET Remoting Assembly

###

[reflection.Assembly]::LoadFrom("C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Bin\Microsoft.Clm.ClmMaProxy.dll")

[reflection.Assembly]::LoadFrom("C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Runtime.Remoting.dll")

 

###

### Set up the remoting infrastructure

###

$clmUrl = "http://localhost/certificatemanagement/clmManagementAgent.rem"

$binaryClientFormatterSinkProvider = new-object System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider

$httpClientChannel = New-Object System.Runtime.Remoting.Channels.Http.HttpClientChannel("ClmHttpChannel", $binaryClientFormatterSinkProvider)

[System.Runtime.Remoting.Channels.ChannelServices]::RegisterChannel($httpClientChannel, $true)

[System.Runtime.Remoting.RemotingConfiguration]::RegisterWellKnownClientType([ExtensibleWfMA.ClmMaProxy], $clmUrl)

$clmMaProxy = New-Object ExtensibleWfMA.ClmMaProxy

$channelProperties = [System.Runtime.Remoting.Channels.ChannelServices]::GetChannelSinkProperties($clmMaProxy)

 

 

###

### Supply the credentials for connecting to CLM

###

$clmUri = [System.Runtime.Remoting.RemotingServices]::Marshal($clmMaProxy).URI

$networkCredentials = New-Object System.Net.NetworkCredential("administrator",’hoofhearted’,"icemelted")

$credentialCache = New-Object System.Net.CredentialCache

$credentialCache.Add($clmUri,'ntlm',$networkCredentials)

$channelProperties.credentials = [System.Net.CredentialCache]$credentialCache

 

###

### Call the ConnectionTest method

###

$clmMaProxy.ConnectionTest()

The commands in the above script use .NET Remoting to connect to the ClmMaProxy which sits on the CM server.  Everything but the last line is setting up the .NET Remoting infrastructure, then finally the last line calls a method “ConnectionTest()” on the ClmMaProxy to uh, test the connection.

If all is good I expect it to return “True”, otherwise an error from the CM service.

No comments: