Partager via


How to: Check for Secure Connections

We recommend that you have a secure connection to the connected data source server before you perform any password management tasks in Forefront Identity Manager Synchronization Service (FIM Synchronization Service).

The following Microsoft Visual Basic Scripting Edition (VBScript) example shows how to use the GetServerStatus Method to verify that you have a secure connection for each of your connected data source servers. This method determines the status of a connected data source server.

Option Explicit

On Error Resume Next

Const PktPrivacy = 6   ' Authentication level
Dim Service            ' Service object
Dim CsObjects          ' CS Object collection
Dim CsObject           ' CS Object
Dim MAObjects          ' Management agent collection
Dim MAObject           ' Management agent object

Set Service = GetObject("winmgmts:{authenticationLevel=PktPrivacy}!root\MicrosoftIdentityIntegrationServer")
Set CsObjects = Service.ExecQuery _
            ("Select * from MIIS_CSObject where domain='Main' and account='Jeff'")

For Each CsObject in Csobjects
    Set MAObjects = Service.ExecQuery _
       ("select * from MIIS_ManagementAgent where guid='"& CSObject.MaGuid &"'")
    For Each MAObject in MAObjects
        WScript.Echo "GetServerStatus returns '" + MAObject.GetServerStatus _
           ( CSObject.PartitionGuid )
    Next
Next

Sub ErrorHandler (ErrorMessage)
  WScript.Echo ErrorMessage
  WScript.Quit(1)
End Sub

See Also

Reference

MIIS_CSObject Class
GetServerStatus Method

Concepts

How to: Enable Security in Scripts
Password Management
Creating Scripts