mirror of
https://github.com/inspec/inspec
synced 2024-11-14 17:07:09 +00:00
Merge pull request #1869 from seththoenen/fix-host-windows
Add warningaction to test-netconnection
This commit is contained in:
commit
b7cc6c31b7
1 changed files with 1 additions and 1 deletions
|
@ -148,7 +148,7 @@ module Inspec::Resources
|
|||
def ping(hostname, port = nil, _proto = nil)
|
||||
# ICMP: Test-NetConnection www.microsoft.com
|
||||
# TCP and port: Test-NetConnection -ComputerName www.microsoft.com -RemotePort 80
|
||||
request = "Test-NetConnection -ComputerName #{hostname}"
|
||||
request = "Test-NetConnection -ComputerName #{hostname} -WarningAction SilentlyContinue"
|
||||
request += " -RemotePort #{port}" unless port.nil?
|
||||
request += '| Select-Object -Property ComputerName, TcpTestSucceeded, PingSucceeded | ConvertTo-Json'
|
||||
cmd = inspec.command(request)
|
||||
|
|
Loading…
Reference in a new issue