Kaspersky Security Center Automation
10.0
|
Find host by filter string. Finds hosts that satisfy conditions from filter string strFilter.
Sample. Function FindHostsForDnFilter finds hosts by the
specified filter string and returns array of host names function FindHostsForDnFilter(oHosts, strFilter) { var oFileds2Return = new ActiveXObject("klakaut.KlAkCollection"); oFileds2Return.SetSize(2); oFileds2Return.SetAt(0, "KLHST_WKS_HOSTNAME"); oFileds2Return.SetAt(1, "KLHST_WKS_DN"); var oFileds2Order = new ActiveXObject("klakaut.KlAkCollection"); var oChunkAccessor = oHosts.FindHosts( strFilter, oFileds2Return, oFileds2Order); var lRecords = oChunkAccessor.Count; oResult = new ActiveXObject("klakaut.KlAkCollection"); oResult.SetSize(lRecords); var enumObj = new Enumerator(oChunkAccessor); i =0; for (;!enumObj.atEnd();enumObj.moveNext()) { var oObj = enumObj.item(); var strName = oObj.Item("KLHST_WKS_HOSTNAME"); var strDN = oObj.Item("KLHST_WKS_DN"); oResult.SetAt(i, strName); ++i; }; return oResult; }; See also Registering update agents for hosts in group sample. |