How do I initiate a remote Insight Discovery scan using Ansible?

Steve Berry October 24, 2022

We are trying to use the Insight Discovery utility to form part of our onboarding process for network devices and we are hoping to be able to automate the process so the Jira ticket prompts the scan of the device and then the asset it created and so on.

We are having issues trying to run the scan (discovery.exe -rs 10.1.1.1) using one of Ansible Windows modules. So far I have tried win_shell, win_command and win_powershell and all give me the same result.

With max verbosity enabled the playbook finishes but the stdout states "cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the serverexplorer, windows services administrative tool or the Net Start command."

I've tried it both with the Insight Discovery service installed and not installed and get the same result regardless.

I feel this should be simple and straightforward but I'm getting nowhere fast at the moment.

2 answers

1 accepted

0 votes
Answer accepted
Steve Berry October 26, 2022

Update:

Managed to get this working by copying PSEXEC to the server hosting the Insight Discovery utility and then using the community.windows.win_psexec ansible module to run the command. Had to also include the switch to make the session interactive and to run as System. All working as intended now. Running it in an interactive session avoids any of the issues regarding the service/instance name differences.

0 votes
Steve Berry October 24, 2022

OK, so got some additional information. When the Ansible playbook runs, the equivalent error see on the server where we installed the Discovery service is indicating that it is looking for a different version of our discovery service. It is looking for servicename_9548D rather than the service name we have available. Is there a way of changing the Discovery instance ID to match that of the service being requested?

Mickey_Corriveau November 4, 2022

I`m trying to run specific scans ever hour in the task schedular with the system account and I have the same issue running in interactive also solves the issue, i`m preyty sure discovery uses environment settings in the user profile in %localappdata% there is Atlassian\ScanViewer.exe_Url_**********************************

Mickey_Corriveau November 4, 2022

I`ve tried copying the folders to C:\Windows\system32\config\systemprofile but it doesn`t work

Suggest an answer

Log in or Sign up to answer