Kaspersky Security Center Automation  10.0
HRESULT IKlAkHosts::AddHost ( [in] IKlAkParams pInfo,
[out, retval] BSTR *  pstrHostName 
)

Create new host record.

Creates new host record.

Parameters:
pInfo IKlAkParams container with host attributes. Must contain following attributes (see List of host attributes).
  • "KLHST_WKS_DN"
  • "KLHST_WKS_GROUPID"
  • "KLHST_WKS_WINDOMAIN", may be empty string only for non-windows hosts
  • "KLHST_WKS_WINHOSTNAME", may be empty string only for non-windows hosts
  • "KLHST_WKS_DNSDOMAIN"
  • "KLHST_WKS_DNSNAME"
Return values:
pstrHostName hostname – unique server-generated string


See JScript sample below.

	var oHosts = new ActiveXObject("klakaut.KlAkHosts");
	oHosts.AdmServer = ...
	...
	//group where hosts will be added
	var lGroup = ...
	...
	var strPartOfName = "MyTestHost";
	var strWinDomain = "MYTESTDOMAIN";
	var strDnsDomain = "mytestdomain.com";
	for(i = 0; i < 10; ++i)
	{
		//Fill container with attributes of host to add
		var oHostPars = new ActiveXObject("klakaut.KlAkParams");
		oHostPars.Add("KLHST_WKS_DN", strPartOfName + "-" + i);
		oHostPars.Add("KLHST_WKS_GROUPID", lGroup);
		oHostPars.Add("KLHST_WKS_WINHOSTNAME", (strPartOfName + "-" + i).toUpperCase() );
		oHostPars.Add("KLHST_WKS_DNSNAME", (strPartOfName + "-" + i).toLowerCase() );
		oHostPars.Add("KLHST_WKS_WINDOMAIN", strWinDomain);
		oHostPars.Add("KLHST_WKS_DNSDOMAIN", strDnsDomain);
		//Add host
		var strAddedHost = oHosts.AddHost(oHostPars);
		...
};