Run management agent ILM 2007
28 мая 2009 г.Posted by
Admin
Comments
Мы настроили ILM 2007 для синхронизации AD c eDirectory и Sun ONE Directory. Теперь постала задача регулярно выполнять MA (management agent).
Вариант 1
Создать скрипт для каждого профиля агента.
Получим следующий скрипт:
Const PktPrivacy = 6rem Const wbemAuthenticationLevelPkt = 6Set Locator = CreateObject("WbemScripting.SWbemLocator")remrem Credentials must only be specified when Microsoft Identity Integration Server is on remote system.remrem Locator.Security_.AuthenticationLevel = wbemAuthenticationLevelPktrem Set Service = Locator.ConnectServer("MyServer", "root/MicrosoftIdentityIntegrationServer")rem Set Service = Locator.ConnectServer("MyServer", "root/MicrosoftIdentityIntegrationServer", "Domain\Me", "MyPassword")remSet Service = GetObject("winmgmts:{authenticationLevel=PktPrivacy}!root/MicrosoftIdentityIntegrationServer")Set MASet = Service.ExecQuery("select * from MIIS_ManagementAgent where Guid = '{12B4583D-C2D8-43A1-BF48-28651247DE41}'")for each MA in MASetWScript.Echo "Running " + MA.name + ".Execute(""Full Import-Full Synchronization"")..."WScript.Echo "Run completed with result: " + MA.Execute("Full Import-Full Synchronization")next
Объединив все профили всех МА в один скрипт.
Вариант 2
Воспользоваться утилитой MASequencer.exe из MIIS 2003 Resource Tool Kit, предварительно создав XML конфиг утилитой MAConfigurationViewer.exe
и запускать MASequencer.exe с параметром /F:<имя конфига>
Вариант 3
создать 2-ва скрипта. Сами скрипты взяты с примеров у Microsoft
MA-Runs.cmd:
@echo offremrem Copyright (c) Microsoft Corporation. All rights reserved.remsetlocalset zworkdir=%~dp0pushd %zworkdir%cscript runMA.vbs /m:"MA_Active_Directory" /p:"Full Import-Full Synchronization"if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)cscript runMA.vbs /m:"MA_Sun" /p:"Full Import-Full Synchronization"if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)cscript runMA.vbs /m:"MA_Novell" /p:"Full Import-Full Synchronization"if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)cscript runMA.vbs /m:"MA_Active_Directory" /p:"Export"if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)cscript runMA.vbs /m:"MA_Sun" /p:"Export"if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script)cscript runMA.vbs /m:"MA_Novell" /p:"Export"if {%errorlevel%} NEQ {0} (echo Error[%errorlevel%]: command file failed) & (goto exit_script):exit_scriptpopdendlocal
runMA.vbs:
option expliciton error resume next'=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='SCRIPT: runMA.vbs'DATE: 2003-02-05'=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='= Copyright (C) 2003 Microsoft Corporation. All rights reserved.'='******************************************************************************'* Function: DisplayUsage'*'* Purpose: Displays the usage of the script and exits ths script'*'******************************************************************************Sub DisplayUsage()WScript.Echo ""WScript.Echo "Usage: runMa </m:ma-name> </p:profile-name>"WScript.Echo " [/s:mms-server-name]"WScript.Echo " [/u:user-name]"WScript.Echo " [/a:password]"WScript.Echo " [/v] Switch on Verbose mode"WScript.Echo " [/?] Show the Usage of the script"WScript.Echo ""WScript.Echo "Example 1: runMa /m:adma1 /p:fullimport"WScript.Echo "Example 2: runMa /m:adma1 /p:fullimport /u:domain\user /a:mysecret /v"WScript.Quit (-1)End Sub'******************************************************************************' Script Main Execution Starts Here'******************************************************************************'--Used Variables--------------------------dim sdim runResultdim rescodedim managementagentNamedim profiledim verbosemodedim wmiLocatordim wmiServicedim managementagentdim serverdim usernamedim password'-----------------------------------------rescode = ParamExists("/?")if rescode = true then call DisplayUsageverbosemode = ParamExists("/v")managementagentName = ParamValue("/m")if managementagentName = "" then call DisplayUsageprofile = ParamValue("/p")if profile = "" then call DisplayUsageif verbosemode then wscript.echo "%Info: Management Agent and Profile is <"& managementagentName &":"& profile &">"if verbosemode then wscript.Echo "%Info: Getting WMI Locator object"set wmiLocator = CreateObject("WbemScripting.SWbemLocator")if err.number <> 0 thenwscript.echo "%Error: Cannot get WMI Locator object"wscript.quit(-1)end ifserver = ParamValue("/s")password = ParamValue("/a")username = ParamValue("/u")if server = "" then server = "." ' connect to WMI on local machineif verbosemode thenwscript.Echo "%Info: Connecting to MMS WMI Service on <" & server &">"if username <> "" then wscript.Echo "%Info: Accessing MMS WMI Service as <"& username &">"end ifif username = "" thenset wmiService = wmiLocator.ConnectServer(server, "root/MicrosoftIdentityIntegrationServer")elseset wmiService = wmiLocator.ConnectServer(server, "root/MicrosoftIdentityIntegrationServer", username, password)end ifif err.number <> 0 thenwscript.echo "%Error: Cannot connect to MMS WMI Service <" & err.Description & ">"wscript.quit(-1)end ifif verbosemode then wscript.Echo "%Info: Getting MMS Management Agent via WMI"Set managementagent = wmiService.Get( "MIIS_ManagementAgent.Name='" & managementagentName & "'")if err.number <> 0 thenwscript.echo "%Error: Cannot get Management Agent with specified WMI Service <" & err.Description & ">"wscript.quit(-1)end ifwscript.echo "%Info: Starting Management Agent with Profile <"& managementagent.name &":"& profile &">"runResult = managementagent.Execute(profile)if err.number <> 0 thenwscript.Echo "%Error: Running MA <"& err.Description & ">. Make sure the correct profile name is specified."wscript.quit(-1)end ifwscript.Echo "%Info: Finish Running Management Agent"wscript.Echo "%Result: <" & CStr(runResult) & ">"wscript.quit(0)'******************************************************************************'* Function: ParamValue'*'* Purpose: Parses the command line for an argument and'* returns the value of the argument to the caller'* Argument and value must be seperated by a colon'*'* Arguments:'* [in] parametername name of the paramenter'*'* Returns:'* STRING Parameter found in commandline'* "" Parameter NOT found in commandline'*'******************************************************************************Function ParamValue(ParameterName)Dim i '* CounterDim Arguments '* Arguments from the command-line commandDim NumberofArguments '* Number of arguments from the command-line commandDim ArgumentArray '* Array in which to store the arguments from the command-lineDim TemporaryString '* Utility string'* Initialize Return Value to e the Empty StringParamValue = ""'* If no ParameterName is passed into the function exitif ParameterName = "" then exit function'* Check if Parameter is in the Arguments and return the valueSet Arguments = WScript.ArgumentsNumberofArguments = Arguments.Count - 1For i=0 to NumberofArgumentsTemporaryString = Arguments(i)ArgumentArray = Split(TemporaryString,":",-1,vbTextCompare)If ArgumentArray(0) = ParameterName ThenParamValue = ArgumentArray(1)exit functionEnd IfNextend Function'******************************************************************************'* Function: ParamExists'*'* Purpose: Parses the command line for an argument and'* returns the true if argument is present'*'* Arguments:'* [in] parametername name of the paramenter'*'* Returns:'* true Parameter found in commandline'* false Parameter NOT found in commandline'*'******************************************************************************Function ParamExists(ParameterName)Dim i '* CounterDim Arguments '* Arguments from the command-line commandDim NumberofArguments '* Number of arguments from the command-line commandDim ArgumentArray '* Array in which to store the arguments from the command-lineDim TemporaryString '* Utility string'* Initialize Return Value to e the Empty StringParamExists = false'* If no ParameterName is passed into the function exitif ParameterName = "" then exit function'* Check if Parameter is in the Arguments and return the valueSet Arguments = WScript.ArgumentsNumberofArguments = Arguments.Count - 1For i=0 to NumberofArgumentsTemporaryString = Arguments(i)If TemporaryString = ParameterName ThenParamExists = trueexit functionEnd IfNextend Function
И запускаем MA-Runs.cmd
Какой бы вариант мы не выбрали, нужно создать scheduled job и запускать от имени пользователя являющимся членом группы MIISOperators
Ярлыки:
ILM 2007
Run management agent ILM 2007
2009-05-28T13:35:00+03:00
Admin
ILM 2007|
Подписаться на:
Комментарии к сообщению (Atom)