// Commented out mbk Feb 2019 // //
Search this site:
Enterprise Search Blog
« NIE Newsletter

Windows Scripting K2: Collection Lists

Last Updated Mar 2009

By: Mark Bennett & Miles Kehoe, New Idea Engineering Inc. - April / May 2004

The Verity K2 Dashboard is a great way to manage your K2 installation, but sometimes you just need to know one small detail and you don't need to go to the length of starting the dashboard, giving the password, and poking through menus to find the nugget you needed to know.

Luckily, on Windows platforms, the Verity VSearch object exposes many of its methods as scripting objects available to Windows Shell Host scripting (see Command Line K2 using Windows Scripting April 2003).

This month we'll show you a small script that lets you determine the status of all of your collections: online, hidden, or offline.

The Program

' Command line searching using windows scripting 
' Usage: cscript collist.vbs
' List status of all Verity K2 collections

' Provided by New Idea Engineering Inc (http://www.ideaeng.com)
' Copyright 2004 New Idea Engineering, Inc.
' For more information contact info@ideaeng.com

Dim s
Dim state

set conOut = WScript.StdOut

' create the VSearch object
set s = CreateObject("Verity.VSearch")

' Get list and count of valid collections
set cList = s.uniqueCollectionsByAlias
cnt = CLng(cList.count)

if(cnt>0) then
conOut.writeline("collection name : status")
for each entry in cList

select case entry.state
case 0
msg= "offline"
case 1
msg= "hidden"
case 2
msg= "online"
case else
msg= "unknown"
end select

conOut.write(entry.alias + " : ")
conOut.writeline("End of collection list")
conOut.writeline("No collections found")
end if

Running the Program / Usage:

  cscript //NOLOGO collist.vbs

Sample Output

collection name : status
minicar : offline
usercoll : hidden
doccoll : online
news : online
apicoll : online
vdocs : offline
public : online
End of collection list


Tested on Verity K2 Version 4.51 and Version 5.5

Program Explanation

The program creates the Verity VSearch object, then calls the uniqueCollectionsbyAlias method. That method returns a collections object clist, which can then be queried for the number of collections (clist.count).

As long as there are collections, the script displays the K2 collection alias and a status string based on the collection object state (entry.state).


The script needs to be run on a system where Verity K2 is installed in order to have access to the VSearch object.

The only documented state values are offline, hidden, and online. There may be additional undocumented values, or Verity may add new states in the future. This script handles the possibility by displaying an unknown state if any unanticipated values return.

Also, since unauthorized use of this script could expose the names of collections you may not want publicized, use care to secure execution permission of the script to users and administrators you trust.