Microsoft Identity Integration Server 2003 Developer Reference

Example: Checking for a Secure Connection

It is recommended that you have a secure connection to the connected data source server before performing any password management tasks.

The following Visual Basic Scripting Edition (VBScript) example shows how to use the GetServerStatus Method of the MIIS_ManagementAgent Class 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

MIIS_CSObject, GetServerStatus Method of the MIIS_ManagementAgent Class, Enabling Security in Scripts