-
Bug
-
Resolution: Not a bug
-
Low
-
None
-
Discovery 3.1.1
-
None
-
Severity 2 - Major
-
Issue Summary
Using PowerShell script to get Hostname failed with error Mandatory Hostname missing
Environment
Discovery tool version 2.29.0, 3.1.0, 3.1.1
Steps to Reproduce
- Enable the 'Use PowerShell' option under the Common tab of the Discovery tools settings.
- Create a working credential for Insight Discovery to use to connect to a host via PowerShell.
- Disable all pattern files and leave only Windows_Hostinfo_Hostname_Model.pat enabled.
- Run a scan.
- Go to the settings again (or edit Discovery.cfg) to disable Windows_Hostinfo_Hostname_Model.pat and enable only Windows_Hostinfo_Hostname_Model_PS.pat.
- Run another scan for the same host.
Expected Results
Both scans should be able to complete without error especially about the hostname, and the hostname should be returned correctly
Actual Results
The scan with the Windows_Hostinfo_Hostname_Model.pat worked fine and hostname is returned correctly, but the scan with Windows_Hostinfo_Hostname_Model_PS.pat couldn't be completed with error "Mandatory Hostname missing".
- debug log from the first scan
C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:40:54 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:40:54 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:40:54 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:40:54 PM : Getting 1 IP's to scan. 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start getting HostInfo. 6/13/2022 4:40:54 PM : Start Scan: 192.168.56.101 6/13/2022 4:40:54 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:40:54 PM : We have 3 credentials in total. 6/13/2022 4:40:54 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:40:54 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:40:54 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1882556 seconds - result: True 6/13/2022 4:40:54 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:40:54 PM : Mac is null. 6/13/2022 4:40:54 PM : Getting basic scan info 6/13/2022 4:40:54 PM : Trying to get HostInfo. 6/13/2022 4:40:54 PM : Using pattern: Windows_Hostinfo_Hostname_Model.pat (v4.0.0) 6/13/2022 4:40:55 PM : Command: SELECT * FROM Win32_ComputerSystem 6/13/2022 4:40:55 PM : Result: WIN-H0HAR9A9BFD 6/13/2022 4:40:55 PM : pattern executed in 0.7146654 seconds 6/13/2022 4:40:55 PM : Trying to get Network Interfaces. 6/13/2022 4:40:55 PM : Total used scan time 1.010029 seconds. 6/13/2022 4:40:55 PM : Finish scan for 192.168.56.101 6/13/2022 4:40:55 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:40:55 PM : Start getting SNMP HostList. 6/13/2022 4:40:55 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:40:55 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:40:55 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:40:55 PM : Possible IPs: 1 6/13/2022 4:40:55 PM : Reachable Host/Devices: 1 6/13/2022 4:40:55 PM : Full-Scanned Hosts: 1 6/13/2022 4:40:55 PM : Full scan time 1 seconds with 4 threads. 6/13/2022 4:40:55 PM : ----------------------------------------------- ...
- debug log from the second scan. We couldn't even see that the Windows_Hostinfo_Hostname_Model_PS.pat was being executed.
C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:48:08 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:48:08 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:48:08 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 IP's to scan. 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start getting HostInfo. 6/13/2022 4:48:08 PM : Start Scan: 192.168.56.101 6/13/2022 4:48:08 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:48:08 PM : We have 3 credentials in total. 6/13/2022 4:48:08 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:48:08 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:48:08 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1590471 seconds - result: True 6/13/2022 4:48:08 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:48:08 PM : Mac is null. 6/13/2022 4:48:08 PM : Getting basic scan info 6/13/2022 4:48:08 PM : Trying to get HostInfo. 6/13/2022 4:48:08 PM : Trying to get Network Interfaces. 6/13/2022 4:48:08 PM : Error: Mandatory Hostname missing for: 192.168.56.101 6/13/2022 4:48:08 PM : Total used scan time 0.2169935 seconds. 6/13/2022 4:48:08 PM : Finish scan for 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:48:08 PM : Start getting SNMP HostList. 6/13/2022 4:48:08 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:48:08 PM : Deleting (Tagged-Host) 192.168.56.101 6/13/2022 4:48:08 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:48:09 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:48:09 PM : Possible IPs: 1 6/13/2022 4:48:09 PM : Reachable Host/Devices: 1 6/13/2022 4:48:09 PM : Deleted Hosts (tagged for delete): 1 6/13/2022 4:48:09 PM : Full scan time 0 seconds with 4 threads. 6/13/2022 4:48:09 PM : -----------------------------------------------
- the result from running the PowerShell command used in the pattern file
PS C:\Users\Administrator> Get-WmiObject Win32_ComputerSystem Domain : michin.internal Manufacturer : innotek GmbH Model : VirtualBox Name : WIN-H0HAR9A9BFD PrimaryOwnerName : Windows User TotalPhysicalMemory : 12821516288
- result by running Hostname.exe from PowerShell
PS C:\Windows\System32> hostname WIN-H0HAR9A9BFD
Workaround
Use the non-PowerShell pattern files to retrieve information from Windows hosts
Form Name |
---|
[JSDSERVER-11824] Windows_Hostinfo_Hostname_Model_PS.pat file is not getting Hostname info as expected, resulting error Mandatory Hostname missing
Resolution | New: Not a bug [ 12 ] | |
Status | Original: In Progress [ 3 ] | New: Closed [ 6 ] |
Status | Original: Needs Triage [ 10030 ] | New: In Progress [ 3 ] |
Assignee | New: vgedzhev [ 8a797fe2b442 ] |
Description |
Original:
h3. Issue Summary
Using PowerShell script to get Hostname failed with error Mandatory Hostname missing h3. Steps to Reproduce # Enable the ['Use PowerShell' option|https://confluence.atlassian.com/insightapps/common-1085180657.html] under the Common tab of the Discovery tools settings. # Create a working credential for Insight Discovery to use to connect to a host via PowerShell. # Disable all pattern files and leave only *Windows_Hostinfo_Hostname_Model.pat* enabled. # Run a scan. # Go to the settings again (or edit Discovery.cfg) to disable *Windows_Hostinfo_Hostname_Model.pat* and enable only *Windows_Hostinfo_Hostname_Model_PS.pat*. # Run another scan for the same host. h3. Expected Results Both scans should be able to complete without error especially about the hostname, and the hostname should be returned correctly h3. Actual Results The scan with the *Windows_Hostinfo_Hostname_Model.pat* worked fine and hostname is returned correctly, but the scan with *Windows_Hostinfo_Hostname_Model_PS.pat* couldn't be completed with error "Mandatory Hostname missing". * debug log from the first scan {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:40:54 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:40:54 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:40:54 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:40:54 PM : Getting 1 IP's to scan. 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start getting HostInfo. 6/13/2022 4:40:54 PM : Start Scan: 192.168.56.101 6/13/2022 4:40:54 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:40:54 PM : We have 3 credentials in total. 6/13/2022 4:40:54 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:40:54 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:40:54 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1882556 seconds - result: True 6/13/2022 4:40:54 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:40:54 PM : Mac is null. 6/13/2022 4:40:54 PM : Getting basic scan info 6/13/2022 4:40:54 PM : Trying to get HostInfo. 6/13/2022 4:40:54 PM : Using pattern: Windows_Hostinfo_Hostname_Model.pat (v4.0.0) 6/13/2022 4:40:55 PM : Command: SELECT * FROM Win32_ComputerSystem 6/13/2022 4:40:55 PM : Result: WIN-H0HAR9A9BFD 6/13/2022 4:40:55 PM : pattern executed in 0.7146654 seconds 6/13/2022 4:40:55 PM : Trying to get Network Interfaces. 6/13/2022 4:40:55 PM : Total used scan time 1.010029 seconds. 6/13/2022 4:40:55 PM : Finish scan for 192.168.56.101 6/13/2022 4:40:55 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:40:55 PM : Start getting SNMP HostList. 6/13/2022 4:40:55 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:40:55 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:40:55 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:40:55 PM : Possible IPs: 1 6/13/2022 4:40:55 PM : Reachable Host/Devices: 1 6/13/2022 4:40:55 PM : Full-Scanned Hosts: 1 6/13/2022 4:40:55 PM : Full scan time 1 seconds with 4 threads. 6/13/2022 4:40:55 PM : ----------------------------------------------- ... {code} * debug log from the second scan. We couldn't even see that the *Windows_Hostinfo_Hostname_Model_PS.pat* was being executed. {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:48:08 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:48:08 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:48:08 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 IP's to scan. 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start getting HostInfo. 6/13/2022 4:48:08 PM : Start Scan: 192.168.56.101 6/13/2022 4:48:08 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:48:08 PM : We have 3 credentials in total. 6/13/2022 4:48:08 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:48:08 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:48:08 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1590471 seconds - result: True 6/13/2022 4:48:08 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:48:08 PM : Mac is null. 6/13/2022 4:48:08 PM : Getting basic scan info 6/13/2022 4:48:08 PM : Trying to get HostInfo. 6/13/2022 4:48:08 PM : Trying to get Network Interfaces. 6/13/2022 4:48:08 PM : Error: Mandatory Hostname missing for: 192.168.56.101 6/13/2022 4:48:08 PM : Total used scan time 0.2169935 seconds. 6/13/2022 4:48:08 PM : Finish scan for 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:48:08 PM : Start getting SNMP HostList. 6/13/2022 4:48:08 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:48:08 PM : Deleting (Tagged-Host) 192.168.56.101 6/13/2022 4:48:08 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:48:09 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:48:09 PM : Possible IPs: 1 6/13/2022 4:48:09 PM : Reachable Host/Devices: 1 6/13/2022 4:48:09 PM : Deleted Hosts (tagged for delete): 1 6/13/2022 4:48:09 PM : Full scan time 0 seconds with 4 threads. 6/13/2022 4:48:09 PM : ----------------------------------------------- {code} * the result from running the PowerShell command used in the pattern file {code} PS C:\Users\Administrator> Get-WmiObject Win32_ComputerSystem Domain : michin.internal Manufacturer : innotek GmbH Model : VirtualBox Name : WIN-H0HAR9A9BFD PrimaryOwnerName : Windows User TotalPhysicalMemory : 12821516288 {code} * result by running Hostname.exe from PowerShell {code} PS C:\Windows\System32> hostname WIN-H0HAR9A9BFD {code} h3. Workaround Use the non-PowerShell pattern files to retrieve information from Windows hosts |
New:
h3. Issue Summary
Using PowerShell script to get Hostname failed with error Mandatory Hostname missing h3. Environment Discovery tool version 2.29.0, 3.1.0, 3.1.1 h3. Steps to Reproduce # Enable the ['Use PowerShell' option|https://confluence.atlassian.com/insightapps/common-1085180657.html] under the Common tab of the Discovery tools settings. # Create a working credential for Insight Discovery to use to connect to a host via PowerShell. # Disable all pattern files and leave only *Windows_Hostinfo_Hostname_Model.pat* enabled. # Run a scan. # Go to the settings again (or edit Discovery.cfg) to disable *Windows_Hostinfo_Hostname_Model.pat* and enable only *Windows_Hostinfo_Hostname_Model_PS.pat*. # Run another scan for the same host. h3. Expected Results Both scans should be able to complete without error especially about the hostname, and the hostname should be returned correctly h3. Actual Results The scan with the *Windows_Hostinfo_Hostname_Model.pat* worked fine and hostname is returned correctly, but the scan with *Windows_Hostinfo_Hostname_Model_PS.pat* couldn't be completed with error "Mandatory Hostname missing". * debug log from the first scan {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:40:54 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:40:54 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:40:54 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:40:54 PM : Getting 1 IP's to scan. 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start getting HostInfo. 6/13/2022 4:40:54 PM : Start Scan: 192.168.56.101 6/13/2022 4:40:54 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:40:54 PM : We have 3 credentials in total. 6/13/2022 4:40:54 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:40:54 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:40:54 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1882556 seconds - result: True 6/13/2022 4:40:54 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:40:54 PM : Mac is null. 6/13/2022 4:40:54 PM : Getting basic scan info 6/13/2022 4:40:54 PM : Trying to get HostInfo. 6/13/2022 4:40:54 PM : Using pattern: Windows_Hostinfo_Hostname_Model.pat (v4.0.0) 6/13/2022 4:40:55 PM : Command: SELECT * FROM Win32_ComputerSystem 6/13/2022 4:40:55 PM : Result: WIN-H0HAR9A9BFD 6/13/2022 4:40:55 PM : pattern executed in 0.7146654 seconds 6/13/2022 4:40:55 PM : Trying to get Network Interfaces. 6/13/2022 4:40:55 PM : Total used scan time 1.010029 seconds. 6/13/2022 4:40:55 PM : Finish scan for 192.168.56.101 6/13/2022 4:40:55 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:40:55 PM : Start getting SNMP HostList. 6/13/2022 4:40:55 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:40:55 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:40:55 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:40:55 PM : Possible IPs: 1 6/13/2022 4:40:55 PM : Reachable Host/Devices: 1 6/13/2022 4:40:55 PM : Full-Scanned Hosts: 1 6/13/2022 4:40:55 PM : Full scan time 1 seconds with 4 threads. 6/13/2022 4:40:55 PM : ----------------------------------------------- ... {code} * debug log from the second scan. We couldn't even see that the *Windows_Hostinfo_Hostname_Model_PS.pat* was being executed. {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:48:08 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:48:08 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:48:08 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 IP's to scan. 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start getting HostInfo. 6/13/2022 4:48:08 PM : Start Scan: 192.168.56.101 6/13/2022 4:48:08 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:48:08 PM : We have 3 credentials in total. 6/13/2022 4:48:08 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:48:08 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:48:08 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1590471 seconds - result: True 6/13/2022 4:48:08 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:48:08 PM : Mac is null. 6/13/2022 4:48:08 PM : Getting basic scan info 6/13/2022 4:48:08 PM : Trying to get HostInfo. 6/13/2022 4:48:08 PM : Trying to get Network Interfaces. 6/13/2022 4:48:08 PM : Error: Mandatory Hostname missing for: 192.168.56.101 6/13/2022 4:48:08 PM : Total used scan time 0.2169935 seconds. 6/13/2022 4:48:08 PM : Finish scan for 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:48:08 PM : Start getting SNMP HostList. 6/13/2022 4:48:08 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:48:08 PM : Deleting (Tagged-Host) 192.168.56.101 6/13/2022 4:48:08 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:48:09 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:48:09 PM : Possible IPs: 1 6/13/2022 4:48:09 PM : Reachable Host/Devices: 1 6/13/2022 4:48:09 PM : Deleted Hosts (tagged for delete): 1 6/13/2022 4:48:09 PM : Full scan time 0 seconds with 4 threads. 6/13/2022 4:48:09 PM : ----------------------------------------------- {code} * the result from running the PowerShell command used in the pattern file {code} PS C:\Users\Administrator> Get-WmiObject Win32_ComputerSystem Domain : michin.internal Manufacturer : innotek GmbH Model : VirtualBox Name : WIN-H0HAR9A9BFD PrimaryOwnerName : Windows User TotalPhysicalMemory : 12821516288 {code} * result by running Hostname.exe from PowerShell {code} PS C:\Windows\System32> hostname WIN-H0HAR9A9BFD {code} h3. Workaround Use the non-PowerShell pattern files to retrieve information from Windows hosts |
Description |
Original:
h3. Issue Summary
Using PowerShell script to get Hostname failed with error Mandatory Hostname missing h3. Steps to Reproduce # Enable the ['Use PowerShell' option|https://confluence.atlassian.com/insightapps/common-1085180657.html] under the Common tab of the Discovery tools settings. # Create a working credential for Insight Discovery to use to connect to a host via PowerShell. # Disable all pattern files and leave only *Windows_Hostinfo_Hostname_Model.pat* enabled. # Run a scan. # Go to the settings again (or edit Discovery.cfg) to disable *Windows_Hostinfo_Hostname_Model.pat* and enable only *Windows_Hostinfo_Hostname_Model_PS.pat*. # Run another scan for the same host. h3. Expected Results Both scans should be able to complete without error especially about the hostname, and the hostname should be returned correctly h3. Actual Results The scan with the *Windows_Hostinfo_Hostname_Model.pat* worked fine and hostname is returned correctly, but the scan with *Windows_Hostinfo_Hostname_Model_PS.pat* couldn't be completed with error "Mandatory Hostname missing". * debug log from the first scan {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:40:54 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:40:54 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:40:54 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:40:54 PM : Getting 1 IP's to scan. 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start getting HostInfo. 6/13/2022 4:40:54 PM : Start Scan: 192.168.56.101 6/13/2022 4:40:54 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:40:54 PM : We have 3 credentials in total. 6/13/2022 4:40:54 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:40:54 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:40:54 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1882556 seconds - result: True 6/13/2022 4:40:54 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:40:54 PM : Mac is null. 6/13/2022 4:40:54 PM : Getting basic scan info 6/13/2022 4:40:54 PM : Trying to get HostInfo. 6/13/2022 4:40:54 PM : Using pattern: Windows_Hostinfo_Hostname_Model.pat (v4.0.0) 6/13/2022 4:40:55 PM : Command: SELECT * FROM Win32_ComputerSystem 6/13/2022 4:40:55 PM : Result: WIN-H0HAR9A9BFD 6/13/2022 4:40:55 PM : pattern executed in 0.7146654 seconds 6/13/2022 4:40:55 PM : Trying to get Network Interfaces. 6/13/2022 4:40:55 PM : Total used scan time 1.010029 seconds. 6/13/2022 4:40:55 PM : Finish scan for 192.168.56.101 6/13/2022 4:40:55 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:40:55 PM : Start getting SNMP HostList. 6/13/2022 4:40:55 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:40:55 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:40:55 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:40:55 PM : Possible IPs: 1 6/13/2022 4:40:55 PM : Reachable Host/Devices: 1 6/13/2022 4:40:55 PM : Full-Scanned Hosts: 1 6/13/2022 4:40:55 PM : Full scan time 1 seconds with 4 threads. 6/13/2022 4:40:55 PM : ----------------------------------------------- ... {code} * debug log from the second scan {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:48:08 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:48:08 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:48:08 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 IP's to scan. 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start getting HostInfo. 6/13/2022 4:48:08 PM : Start Scan: 192.168.56.101 6/13/2022 4:48:08 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:48:08 PM : We have 3 credentials in total. 6/13/2022 4:48:08 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:48:08 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:48:08 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1590471 seconds - result: True 6/13/2022 4:48:08 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:48:08 PM : Mac is null. 6/13/2022 4:48:08 PM : Getting basic scan info 6/13/2022 4:48:08 PM : Trying to get HostInfo. 6/13/2022 4:48:08 PM : Trying to get Network Interfaces. 6/13/2022 4:48:08 PM : Error: Mandatory Hostname missing for: 192.168.56.101 6/13/2022 4:48:08 PM : Total used scan time 0.2169935 seconds. 6/13/2022 4:48:08 PM : Finish scan for 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:48:08 PM : Start getting SNMP HostList. 6/13/2022 4:48:08 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:48:08 PM : Deleting (Tagged-Host) 192.168.56.101 6/13/2022 4:48:08 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:48:09 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:48:09 PM : Possible IPs: 1 6/13/2022 4:48:09 PM : Reachable Host/Devices: 1 6/13/2022 4:48:09 PM : Deleted Hosts (tagged for delete): 1 6/13/2022 4:48:09 PM : Full scan time 0 seconds with 4 threads. 6/13/2022 4:48:09 PM : ----------------------------------------------- {code} * the result from running the PowerShell command used in the pattern file {code} PS C:\Users\Administrator> Get-WmiObject Win32_ComputerSystem Domain : michin.internal Manufacturer : innotek GmbH Model : VirtualBox Name : WIN-H0HAR9A9BFD PrimaryOwnerName : Windows User TotalPhysicalMemory : 12821516288 {code} * result by running Hostname.exe from PowerShell {code} PS C:\Windows\System32> hostname WIN-H0HAR9A9BFD {code} h3. Workaround Use the non-PowerShell pattern files to retrieve information from Windows hosts |
New:
h3. Issue Summary
Using PowerShell script to get Hostname failed with error Mandatory Hostname missing h3. Steps to Reproduce # Enable the ['Use PowerShell' option|https://confluence.atlassian.com/insightapps/common-1085180657.html] under the Common tab of the Discovery tools settings. # Create a working credential for Insight Discovery to use to connect to a host via PowerShell. # Disable all pattern files and leave only *Windows_Hostinfo_Hostname_Model.pat* enabled. # Run a scan. # Go to the settings again (or edit Discovery.cfg) to disable *Windows_Hostinfo_Hostname_Model.pat* and enable only *Windows_Hostinfo_Hostname_Model_PS.pat*. # Run another scan for the same host. h3. Expected Results Both scans should be able to complete without error especially about the hostname, and the hostname should be returned correctly h3. Actual Results The scan with the *Windows_Hostinfo_Hostname_Model.pat* worked fine and hostname is returned correctly, but the scan with *Windows_Hostinfo_Hostname_Model_PS.pat* couldn't be completed with error "Mandatory Hostname missing". * debug log from the first scan {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:40:54 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:40:54 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:40:54 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:40:54 PM : Getting 1 IP's to scan. 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:54 PM : Start getting HostInfo. 6/13/2022 4:40:54 PM : Start Scan: 192.168.56.101 6/13/2022 4:40:54 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:40:54 PM : We have 3 credentials in total. 6/13/2022 4:40:54 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:40:54 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:40:54 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1882556 seconds - result: True 6/13/2022 4:40:54 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:40:54 PM : Mac is null. 6/13/2022 4:40:54 PM : Getting basic scan info 6/13/2022 4:40:54 PM : Trying to get HostInfo. 6/13/2022 4:40:54 PM : Using pattern: Windows_Hostinfo_Hostname_Model.pat (v4.0.0) 6/13/2022 4:40:55 PM : Command: SELECT * FROM Win32_ComputerSystem 6/13/2022 4:40:55 PM : Result: WIN-H0HAR9A9BFD 6/13/2022 4:40:55 PM : pattern executed in 0.7146654 seconds 6/13/2022 4:40:55 PM : Trying to get Network Interfaces. 6/13/2022 4:40:55 PM : Total used scan time 1.010029 seconds. 6/13/2022 4:40:55 PM : Finish scan for 192.168.56.101 6/13/2022 4:40:55 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:40:55 PM : Start getting SNMP HostList. 6/13/2022 4:40:55 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:40:55 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:40:55 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:40:55 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:40:55 PM : Possible IPs: 1 6/13/2022 4:40:55 PM : Reachable Host/Devices: 1 6/13/2022 4:40:55 PM : Full-Scanned Hosts: 1 6/13/2022 4:40:55 PM : Full scan time 1 seconds with 4 threads. 6/13/2022 4:40:55 PM : ----------------------------------------------- ... {code} * debug log from the second scan. We couldn't even see that the *Windows_Hostinfo_Hostname_Model_PS.pat* was being executed. {code} C:\Users\Administrator\Downloads\Discovery_3.1.1>discovery -rs 192.168.56.101 6/13/2022 4:48:08 PM : --------------- Start Discovery (3.1.1.0 - BF500) scan --------------- 6/13/2022 4:48:08 PM : ScanSetting: Single scan with entire Range: 192.168.56.101 6/13/2022 4:48:08 PM : Generating list of IP's to scan from range: 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 IP's to scan. 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Start getting HostInfo. 6/13/2022 4:48:08 PM : Start Scan: 192.168.56.101 6/13/2022 4:48:08 PM : Ping 192.168.56.101 --> Success ResponseTime=0ms TTL=128 6/13/2022 4:48:08 PM : We have 3 credentials in total. 6/13/2022 4:48:08 PM : We have 1 possible Known-Credetentials for the ip 192.168.56.101 6/13/2022 4:48:08 PM : Start WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 6/13/2022 4:48:08 PM : Finish WMI/PowerShell-Connection (69433ea9-6463-4ead-b82a-1b9f3769c296) to 192.168.56.101 - used 0.1590471 seconds - result: True 6/13/2022 4:48:08 PM : Connected to 192.168.56.101 with WMI-Credential: 69433ea9-6463-4ead-b82a-1b9f3769c296 6/13/2022 4:48:08 PM : Mac is null. 6/13/2022 4:48:08 PM : Getting basic scan info 6/13/2022 4:48:08 PM : Trying to get HostInfo. 6/13/2022 4:48:08 PM : Trying to get Network Interfaces. 6/13/2022 4:48:08 PM : Error: Mandatory Hostname missing for: 192.168.56.101 6/13/2022 4:48:08 PM : Total used scan time 0.2169935 seconds. 6/13/2022 4:48:08 PM : Finish scan for 192.168.56.101 6/13/2022 4:48:08 PM : Getting 1 HostInfo (RAW) 6/13/2022 4:48:08 PM : Start getting SNMP HostList. 6/13/2022 4:48:08 PM : Getting 0 SNMP Hosts (RAW) 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Finished Scan Thread: Single scan IP: 192.168.56.101 TaskID: 0000000001 6/13/2022 4:48:08 PM : Scan Threads: waiting=0, running=0, stopped=1, sum=1 6/13/2022 4:48:08 PM : Deleting (Tagged-Host) 192.168.56.101 6/13/2022 4:48:08 PM : Check for available VM-Guest IPs to scan. 6/13/2022 4:48:09 PM : -------------- Discovery scan Statistic -------------- 6/13/2022 4:48:09 PM : Possible IPs: 1 6/13/2022 4:48:09 PM : Reachable Host/Devices: 1 6/13/2022 4:48:09 PM : Deleted Hosts (tagged for delete): 1 6/13/2022 4:48:09 PM : Full scan time 0 seconds with 4 threads. 6/13/2022 4:48:09 PM : ----------------------------------------------- {code} * the result from running the PowerShell command used in the pattern file {code} PS C:\Users\Administrator> Get-WmiObject Win32_ComputerSystem Domain : michin.internal Manufacturer : innotek GmbH Model : VirtualBox Name : WIN-H0HAR9A9BFD PrimaryOwnerName : Windows User TotalPhysicalMemory : 12821516288 {code} * result by running Hostname.exe from PowerShell {code} PS C:\Windows\System32> hostname WIN-H0HAR9A9BFD {code} h3. Workaround Use the non-PowerShell pattern files to retrieve information from Windows hosts |