Kaspersky Security Center Automation
10.0
|
JScript sample code.
function AcquireAdServerProxy() { var oSrvConnectionProps = new ActiveXObject("klakaut.KlAkParams"); oSrvConnectionProps.Add("Address", "localhost:13000"); oSrvConnectionProps.Add("UseSSL", true); var oAdmServer = new ActiveXObject("klakaut.KlAkProxy"); oAdmServer.Connect(oSrvConnectionProps); g_oLog.WriteLine("Server version is " + oAdmServer.VersionId); return oAdmServer; }; function EnumerateGroups(oSubgroupsEnum, nLevel) { var enumObj = new Enumerator(oSubgroupsEnum); for (;!enumObj.atEnd();enumObj.moveNext()) { var oObj = enumObj.item(); var nId = oObj.Item("id"); var strName = oObj.Item("name"); // form indention for logging var strIndention = " "; for(ii =0; ii < nLevel; ++ii) strIndention += " "; strIndention += "+-" // log found group g_oLog.Write(strIndention); g_oLog.WriteLine("Subgroup: " + strName + ", id: " + nId); if(oObj.Check("groups")) { var groups = oObj.Item("groups"); EnumerateGroups(groups, nLevel+1); }; }; }; var g_oFileSystemObject; var g_oLog; // prepare logging g_oFileSystemObject = new ActiveXObject("Scripting.FileSystemObject"); g_oLog = g_oFileSystemObject.CreateTextFile("log.txt", true); var oAdmServer = AcquireAdServerProxy(); var oGroups = new ActiveXObject("klakaut.KlAkGroups"); oGroups.AdmServer = oAdmServer; g_oLog.WriteLine("GroupIdGroups is " + oGroups.GroupIdGroups); EnumerateGroups(oGroups.GetSubgroups(oGroups.GroupIdGroups, 0), 0); g_oLog.Close();