Preparations

In this scenario, a script will initiate a remote inventory scan to run according to a predefined list of target computers.

Scan options

There are two possible ways to perform a zero footprint scan:

  • Copy the agent files directly to the target machine (Remote copy mode)

  • Use a network share folder for storing agent files and result files (Net share mode)

Generate list

The list must at least contain IP addresses or hostnames of the computers to be inventoried. If different user accounts need to be used for the inventory, user credentials for each computer must be provided in the list.

The list can be put together using information from Snow Inventory Admin Console, from a CMDB, or from any other tool that holds an inventory of the target computers, such as a network monitoring tool, a system operations tool, or a service desk tool.

Prepare agent and configuration files

Remote copy mode

Prepare necessary Snow Inventory Agent files for each computer that will be inventoried using the script for remote scan. If Snow Inventory Oracle Scanner (SIOS) is to be used, the sios.jar file needs to be copied.

Make adjustments to the configuration file as needed. The recommendation is to use the Snow Inventory Admin Console for editing of the configuration file. For detailed information, refer to Snow Inventory Admin Console and the sections for each specific platform.

Decide how to handle result file

There are two options for handling of the inventory result file:

  • As a part of the inventory, let the Snow Inventory Agent send the result file directly to the Snow Inventory Server. The server endpoint must be defined in the configuration file of the Snow Inventory agent.

  • As a part of the remote inventory script, copy the result files from the inventoried computers to the computer running the remote inventory script. The inventory files then need to be processed by the Snow Inventory Master Server.

Net share mode

Prepare a shared folder that is accessible from the same network as where the target machines are located, SMB based sharing is recommended. The folder must be configured to allow guest access with no password required and give users full read/write permissions.

Copy agent files and corresponding configuration files to this folder. Mount the folder on the target and execute scan.

Decide how to handle result file

There are two options for handling of the inventory result file:

  • As a part of the inventory, let the Snow Inventory Agent send the result file directly to the Snow Inventory Server. The server endpoint must be defined in the configuration file of the Snow Inventory agent.

  • The default configuration setting will put the result files in the data folder in your current location. We recommend to switch to the mounted folder before executing the scan so the result files will be placed in the mounted folder. After completion, the files need to be processed by the Snow Inventory Master Server.

Create script

The script can be written in any scripting language and must be run on a computer with network access to the target computers.

The script consists of two parts – local runner (1) that iterates over hosts and executes remote commands (2) in order to perform the scan.

Remote scan commands (2) support two different scenarios – Remote copy mode when agent files are copied to the target, and Net share mode when agent files reside on a network share accessible to all targets.

Local runner (1)

This example of the local runner script assumes that either host name or IP address is provided for each of the target machines. If no host name is given, the script tries to resolve it from given IP address. The target information is stored in the hosts_win.txt file as comma-separated values which have the following format of host entries:

<Host Name>,<IP address>

Example 59.
HOST1,10.100.1.15
,10.100.1.12
HOST3,


The local runner script for executing in Windows

$hosts = Get-Content -Path ".\hosts_win.txt"

$Credentials = Get-Credential
foreach ($target in $hosts) {
    $targetList = $target.split(',')

    if ($targetList[0]) {
    $hostname = $targetList[0]

    }
    elseif ($targetList[1]){
        $hostname = ([system.net.dns]::GetHostByAddress($targetList[1])).hostname
    }

    $remoteSession = New-PSSession -ComputerName $hostname -Credential $Credentials

        # PUT COMMANDS FOR EXECUTING REMOTE SCAN HERE (2)

    Remove-PSSession -Session $remoteSession

}

The local runner script for executing in Linux

#!/usr/bin/env bash
hostsfile="hosts_linux.txt"
while read -r line
do
    IFS=',' read -r -a hosts <<< "$line"
    if [ ! -z ${hosts[0]} ]; then
        target=${hosts[0]}
    elif [ ! -z ${hosts[1]} ]; then
        target=${hosts[1]}
    fi

    # PUT COMMANDS FOR EXECUTING REMOTE SCAN HERE (2)

done < "$hostsfile"

Commands for Remote copy mode (2)

For each of the target computers in the list, the following actions need to be performed:

  1. Connect to the target computer using provided user credentials.

  2. Copy the Snow Inventory agent and the configuration file to the target computer.

  3. Run the Snow Inventory agent.

  4. Monitor the running process of the Snow Inventory agent.

  5. After the completed inventory (i.e. when the process is no longer running):

    1. If it has not been sent already by the Snow Inventory agent, copy the inventory result file to the computer running the remote inventory script.

    2. Remove the Snow Inventory agent, the configuration file, the inventory result file, and log files from the target computer.

  6. Disconnect from the target computer.

Commands for Net share mode (2)

For each of the target computers in the list, the following actions need to be performed:

  1. Connect to the target computer using provided user credentials.

  2. If required by the operating system (non-Windows operating systems), mount the shared network folder.

  3. Create a new folder where the result files will be placed unless non-default drop location is specified in the configuration file.

  4. Switch to the newly created folder.

  5. Run the Snow Inventory agent.

  6. After the completed inventory (i.e. when the process is no longer running), unmount the folder, if required by the operating system (non-Windows operating systems).

  7. Disconnect from the target computer.