// Variables var iComPort = 1; // Modify this value if your network is located on another COM port var iBaudRate = 19200; // Modify this value if your readers operate at a different baudrate var iInstallerPassword = 123456789; // Modify this value if your reader has another installer level password Main(); // All functionality is placed in a function to increase readability function Main() { // Create the main API application object var oApp = new ActiveXObject("TalosAPI.Application"); if (oApp) { // Create/find a network var oNetwork = oApp.FindReaderNetwork(iComPort); if (oNetwork) { // Connect/open the network if (oNetwork.Connect(iBaudRate)) { // Scan all readers from address 0 to 32 // Note that we scan synchronously here, meaning that this method will block // until it has scanned all readers. if (oNetwork.ScanReaders(false, 0, 32)) { if (oNetwork.ReaderCount == 0) { WScript.Echo("No readers found from address 0 to 32!"); return; } // Use the first reader var oReader = oNetwork.Readers.FirstItem; if (!oReader) { WScript.Echo("Error, failed to get the first reader!"); return; } // Very essential: log-on to the reader (2 = installer level, true = auto-authorize) if (!oReader.Logon(2, iInstallerPassword, true)) { WScript.Echo("Error while logging on to the reader! Is the value '" + iInstallerPassword + "' a valid password?"); return; } // The reader is now logged on, display the number of users WScript.Echo("Reader: '" + oReader.Name + "' contains " + oReader.UserDatabase.Count + " users."); // Finish oReader.Logoff(); } else { WScript.Echo("Error, failed to scan readers!"); } oNetwork.Disconnect(); } else { WScript.Echo("Error, failed to connect to the network!"); } } else { WScript.Echo("Error, no network found on COM1, specify another COM port in the script!"); } } else { WScript.Echo("Error, failed to create the application object! Is the TalosAPI registered?"); } }