Resident agent scan

This type of scan uses TNI’s Windows agent to automatically scan any Windows computer without the main unit’s direct participation. It can be arranged by installing the resident agent as a service on the remote computer. The service then performs scheduled scans and can send the data file – generated after each scan – via e-mail or FTP, or save it to a network share. Then the data files can be imported to the TNI Storage either manually or automatically.

The advantages of this scanning method are:

  • collecting information from computers that the main TNI unit has no or limited access to;
  • reducing the load on the network infrastructure: the scanning process takes place locally on a device, only the scan results are transferred;
  • reducing the load on the main module of the program in terms of reducing the use of resources required for calculations, data processing, reporting, etc. Facilitates and accelerates the execution of other operations;
  • advanced options to set up individual schedule tasks for both individual devices and their groups;
  • obtaining up-to-date information about the status of resident agents, as well as their profile settings in the corresponding TNI scan panel.

Setting up the resident agent

Automatic resident agent deployment and uninstallation

Attention!

Before you start working with the resident agent, you need to configure a Data transfer method to send scanning results to a remote resource.

Go to the Scanner  tab and click the Resident agent button on the Sidebar.

Before deployment, you need to add a scan task, set up profile settings, select logins and click Deploy resident agent on the Sidebar.

Elements description:

  • Deploy resident agent. The main TNI unit uploads tniwinagent.exe and tniwinagent.ini to remote computer folder C:\Windows\TNIRESIDENTAGENT and then connects to the Service Control Manager to install and start the agent as a service.
  • Remove resident agent. The main TNI unit connects to the Service Control Manager to stop and uninstall the resident agent service. Folder TNIRESIDENTAGENT is deleted.

  • Set up logins. Allows you to set up logins for connecting to a remote computer to transfer the agent file. Agent deployment will only accept credentials for Windows-based devices.

  • Clear all. All created deployment tasks will be erased.

Buttons Deploy and Remove resident agent will be displayed only if tasks have been added to the task list.

When the resident agent is removed, all content from TNIRESIDENTAGENT, including inventory files and logs, is deleted permanently.

Resident agent profiles

All settings of resident agents can be saved and stored in profiles. The number of created profiles is not limited. You can assign a profile to both a resident agent individually and their groups by holding down CTRL and selecting the necessary devices with the cursor.

A default profile is always presented in which you can change the settings, but it is not available for renaming and deleting. All changes entered to the default profile will be applied to all resident agents unless any other profile is selected.

Click Add a new profile on the Scanner details information panel to create a new profile, or select the appropriate Add button from the drop-down menu of the Profile column.

In the opened Profile Settings window, you can specify a name for the profile, as well as select the Auto-export resident agent profiles option. This option specifies where the profiles will be exported automatically if they are changed in any way, or if there are any updates of the agent file were released. If you select the option, you will need to specify or create an appropriate data transfer method.

It is highly recommended to indicate the same network resource that is specified for the automatic update of the resident agent, so that the agent could receive its updates.

Using a simple selection of a node or a group of assets in the network tree and with the context menu, you can assign one profile that will be common to them.

If necessary, the Clear button will remove the used profile on the asset(s), but the profile itself will not be removed from the list of profiles.

Assigning a profile to nodes in the network tree will only be possible provided all devices are based on Windows OS.

When you select another profile or change it, an informational panel will immediately appear in the status panel area, when clicked, a task will be created to update the profile of a resident agent in the Scanner tab.

A full profile change will require the agent to be redeployed to the device either automatically or manually.

If necessary, you can use Assistant in the network tree.

Resident agent settings

The following options allow you to fully configure the resident agent, according to your requirements.

  • Run test scan immediately after service start – a test scan will be performed immediately after the agent file is deployed and its service is installed. After scanning is made, the results are then sent according to the specified data transfer method. This command is executed without regard to scheduled tasks. The option is similar to a manual start with the commands “/testrun /install
  • Run a scan every time Windows starts– starts scanning after OS boot. By default, the scan process starts 5 minutes after loading of the OS. The period was set in order that all system processes and services have been loaded before collecting information.
    Additional settings:
    startup-scan-delay={X}“: the parameter can be changed in the tniwinagent.ini file after exporting it, where {X}: 0 — complete delay deactivation, and 60 — is the maximum value in minutes (scanning will be performed within one hour after the OS start).
    resident-agent-startup-scan-delay={X}“: the parameter is located in the config.ini file in C:\ProgramData\Total Network Inventory. When generating tniwinagent.ini, the specified value {X} will be automatically substituted into the “startup-scan-delay” parameter.
  • Overwrite the asset file upon rescan – disable adding a timestamp to the device data file. If a data file with the same name is found on a network-shared resource or a server, the file is overwritten.
  • Auto-update the agent or settings from a network resource – allows you to set the path to the folder on a web or file server that the resident agent can self-update or obtain new settings from. See Updating the resident agent. The following protocols are available:  SMB, HTTP, HTTPS, FTP, FTPS, SFTP, and SCP.
  • Send scan results / Data transfer method – allows you to select the data transfer method for sending scan results. The data will be sent to the specified resource. If no transfer protocol is selected, the files will be saved to the current folder where the agent is installed (for the automatically deployed agent, it’s C:\Windows\TNIRESIDENTAGENT\).
  • Keep sent data in the ‘Sent’ folder – allows disabling automatic deletion of inventory files after they’re sent. Files can be found in the subfolder Sent inside the current folder where the agent is installed (for the automatically deployed agent, it’s C:\Windows\TNIRESIDENTAGENT\Sent\).
  • Attempt to avoid simultaneous requests to the server – allows avoiding multiple simultaneous requests of resident agents that have the same settings on the device. The start time of the agent update and scan results sending tasks will be changed when the agent is started.

After the scan results sending is configured in the agent, do not forget to create a data import task in TNI so that the data is correctly imported and processed in the program storage.

Resident agent schedule

The agent can perform 3 types of tasks. You will be able to configure them in a similar way as in the Scheduler.

  • Scan. The agent will collect information from an asset and attempt to send out the results of scanning.
  • Agent update. The agent will check for updates of the executable file and the configuration file according to the schedule you specify.
  • Resend data. If the agent could not send the scan results immediately after scanning for some reason, this task will make sure that the results are transferred according to a created Data transfer method.

If the computer where the Resident agent service has been deployed is not running at a scheduled time, the agent will run a scan once the computer is started.

If the “Resend Data” and “Agent Update” tasks have not been added during configuration, they will be automatically created when the agent is run for the first time, to be performed every 1 and 4 hours, respectively (provided that the transfer method and the update path are selected).

Creating a scheduled scan is a crucial part of the setup process. If the schedule is not created and “Run a scan every time Windows starts” is not enabled, no scans or data transfers will be made.

Sensors

functionality allows enabling constant monitoring and collecting data from hardware sensors. The data are statistical, and they are processed in the main module of TNI. Visit the Sensors page to get more details.

By default, the Light mode is selected. Advanced mode allows changing sensors’ polling values and collected information.

Attention!

Changing sensor settings in Advanced mode can lead to a considerable increase in the load on both the scanned device and the size of the device’s file, therefore significantly growing the total size of the storage.

Advanced mode has the following settings:

  • Sensor polling period — the option sets up a period of time with which all available sensors are polled. When the value reduces, the accuracy gets better. Increased value improves the stability of a scanned system. By default — 1000 ms.
  • Data record interval —  to reduce stored and transferred data the collected information is packed into packages. The packages contain 3 values: minimum, average and maximum. The option determines a period of time within which the average values are stored. If the value reduces, the data density increases. If the value increases, the volume of collected and transferred data diminishes. By default — 3600 sec. Attention: constant data collection and its storing with a small argument value may lead to significant storage growth.
  • Grouping data to be sent —  the value sets a number of the data packages that can be saved into a file and imported to the program storage. Decreasing the value increases the frequency of sending new data to TNI. When increasing the value, the load on the network diminishes because of a small number of opened connections and sent files. By default — 3 packages.

The followed sensor locations are available:  CPU, GPU, Motherboard, Storage device, NetworkBattery.

Selection of the type of sensor allows you to specify the parameter of the information collected from the devices. The next types are available: Temperature, Fan speed, Utilization, Clock speed, Voltage, Current, and Power.

Export resident agent

In addition to automatic export in the profile settings, export can be executed manually. The Export resident agent button is located on the agent profiles panel of the main area of the Scanner and allows you to export all available profiles.

It copies the agent files to the specified folder (for manual agent deployment). The exported files are tniwinagent.exe and tniwinagent.ini. A unique key in the tniwinagent_{GUID}.ini format is added to the name of the exported configuration files. For instance, tniwinagent_{DAD9B996-A618-4498-B958-BC507CA2BE7B}.ini

For the correct export of all resident agent settings please look at Updating the resident agent and its settings.

Agent States

The states panel of resident agents is used to display all information about the states of agents on computers. It contains records of all hosted agents on Windows devices and indicates when they need to be updated. It also stores records of assigning certain profiles to devices before they are installed on remote devices.

The Update resident agents button creates a list of the agent file deployment tasks for all nodes that require updating.

When you enter this mode, the program performs a data check based on previously created device snapshots and determines the necessity to update the agent files and their profiles. If outdated agents are detected, this will be reported in the states panel report and a corresponding pop-up panel will be displayed above the main area of the Scanner tab.

Manual adding and removal of the resident agent

Manual deployment can be used when the computer to be inventoried is not connected to your network or cannot be automatically deployed for any reason.

For manual deployment, the following steps have to be taken:

  1. Set up the resident agent and its Schedule. Use the Export resident agent button to place tniwinagent.exe and tniwinagent.ini into an empty folder.
  2. Using the Export resident agent button on the Agent profiles panel, select an empty folder where the tniwinagent.exe and tniwinagent_{*}.ini files will be copied.
  3. After exporting the files, select one profile you need for manual installation and rename it to tniwinagent.ini. The profile name can be found by opening the *.ini file in any text editor.
  4. Copy or move these files to an empty directory on the remote computer where the agent has to be installed. Make sure that the directory will not be deleted from the remote computer by accident.
  5. Install the resident agent service from the resident agent folder using this command:
    tniwinagent.exe /install
    The following switches can also be used during installation:
    /start will start the service right after the installation;
    /testrun will run a test scan when the service is started for the first time, and the resulting data will afterward be transferred via the selected protocol.
    If you haven’t used the /start switch with /install, you can start the service manually using the services.msc applet, or from the command window using the net start TNIResidentAgent or sc start TNIResidentAgent command.
    Exampletniwinagent.exe /install /start /testrun — installing the agent service, starting it, and performing a test scan right away.

To remove the service, use the following command:
tniwinagent.exe /uninstall

A message will notify you when the service is successfully installed or uninstalled.

Updating the resident agent and its settings

The resident agent can be updated on the remote computers using one of the following methods:
  1. Re-deploy the agent from the Scanner in TNI.

In this case, do not remove the resident agent first; otherwise, the contents of the agent’s folder – including any saved scan results – will be deleted.

 2. Configure auto-updates from a network resource. For this, enable this option from agent profile settings and specify the path to the directory where the updated versions of the agent and the settings file will be placed. If only the settings need to be updated, then the settings file (tniwinagent.ini) alone may be copied into the specified directory, without the agent file.
The resident agent automatically checks for updates according to the specified schedule tasks. The following protocols for updating are available: SMB, HTTP, HTTPS, SCP, FTP, FTPS, SFTP.

Example path for updating via SMB:
\\computername\folder\

Example path for updating via HTTP:
http://websiteaddress/folder/

Example path for updating via HTTPS:
https://serveradress:44300/TNIAgentFolder/

Example path for updating via SCP:
scp://serveradress:22/TNIAgentFolder/

Example path for updating via FTP/FTPS:
ftp://serveradress:21/TNIAgentFolder/

Example path for updating via SFTP:
sftp://serveradress:22/TNIAgentFolder/

It’s not possible to update the agent without the settings *.ini file.

When entering paths, you can omit ports. In this case, the resident agent, while sending the data, will use the ports for the protocols that are used generally by default.

Resident agent export for TNI versions 5.3.1 and earlier

Due to changes made in the format of the names of the configuration files of resident agents, they will not be read by active TNI agents from versions 5.3.1 and earlier.

Solution: to update the agents, you need to reinstall the resident agents on the new version of TNI from the new scanner mode; or after exporting the configuration file of the new format and copying it to the network shared resource specified for agent auto-update, rename the exported file to tniwinagent.ini

For example: After export, rename the tniwinagent_{DAD9B996-A618-4498-B958-BC507CA2BE7B}.ini configuration file to tniwinagent.ini

This renaming will only be required once between versions <5.3.1 and 5.4.0

 3. Manual updatingSet up the resident agent as usual and export it to get an updated tniwinagent.ini file (and an up-to-date tniwinagent.exe as well).

Stop the service on the target computer using the services.msc applet or from the command window with the net stop TNIResidentAgent or sc stop TNIResidentAgent command.

Copy the new tniwinagent.ini file (and tniwinagent.exe itself, if needed) to the agent folder, overwriting the existing one, and start the service (for example, using net start TNIResidentAgent or sc start TNIResidentAgent). If you only want to update the settings and will copy the new .ini file before stopping or restarting the service, it will be overwritten with the previous settings that the agent still has in memory, so you need to stop the service beforehand.

When the service starts, 6 daily scheduled tasks are created to check for updates – the next minute after the start of the service is done and then 5 more every 4 hours.

Contents