Method: PSWindows::Exec#get_ip

Defined in:
lib/beaker/host/pswindows/exec.rb

#get_ipObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/beaker/host/pswindows/exec.rb', line 23

def get_ip
  ip = execute("for /f \"tokens=14\" %f in ('ipconfig ^| find \"IP Address\"') do @echo %f").strip
  if ip == ''
    ip = execute("for /f \"tokens=14\" %f in ('ipconfig ^| find \"IPv4 Address\"') do @echo %f").strip
  end
  if ip == ''
    ip = execute("for /f \"tokens=14\" %f in ('ipconfig ^| find \"IPv6 Address\"') do @echo %f").strip
  end
  ip
end