KSC Open API  13.0
Kaspersky Security Center API description
wstring HostGroup::AddHost ( params  pInfo)

Creates the new host record.

Parameters:
pInfo(params) container with the host attributes. Must contain the following attributes (see List of the host attributes):
  • "KLHST_WKS_DN".
  • "KLHST_WKS_GROUPID".
  • "KLHST_WKS_WINDOMAIN". This string can be empty only for hosts not running Windows.
  • "KLHST_WKS_WINHOSTNAME". This string can be empty only for hosts not running Windows.
  • "KLHST_WKS_DNSDOMAIN".
  • "KLHST_WKS_DNSNAME".
  • "KLHST_WKS_IP". Optional.
  • "KLHST_WKS_MAC_ADDRESSES", paramArray. Each element must have the paramBinary type and a length of 6 bytes. Optional.
Returns:
(wstring) unique string generated by the server.

See also how to use the KlAkOAPI Python package:

            server = KlAkOAPI.AdmServer.KlAkAdmServer.Create("https://ksc.example.com:13299", "username", "password", verify = False)
            oHostGroup = KlAkOAPI.HostGroup.KlAkHostGroup(server)
            nRootGroupId = oHostGroup.GroupIdGroups().RetVal()
            nNewGroupId = oHostGroup.AddGroup({'name': 'Test group', 'parentId': nRootGroupId}).RetVal()
            strPartOfName = "MyTestHost"
            strWinDomain = "MYTESTDOMAIN"
            strDnsDomain = "mytestdomain.com"
            for i in range(10):
                oHostPars = KlAkOAPI.Params.KlAkParams()
                oHostPars.AddString("KLHST_WKS_DN", strPartOfName + "-" + str(i))
                oHostPars.AddInt("KLHST_WKS_GROUPID", nNewGroupId)
                oHostPars.AddString("KLHST_WKS_WINHOSTNAME", (strPartOfName + "-" + str(i)).upper() )
                oHostPars.AddString("KLHST_WKS_DNSNAME", (strPartOfName + "-" + str(i)).lower() )
                oHostPars.AddString("KLHST_WKS_WINDOMAIN", strWinDomain)
                oHostPars.AddString("KLHST_WKS_DNSDOMAIN", strDnsDomain)
                strAddedHost = oHostGroup.AddHost(oHostPars)