Powershell get ipv4 address into a variable

后端 未结 12 2323
长情又很酷
长情又很酷 2021-01-31 08:23

Is there an easy way in powershell 3.0 Windows 7 to get the local computer\'s ipv4 address into a variable?

12条回答
  •  花落未央
    2021-01-31 09:21

    To grab the device's IPv4 addresses, and filter to only grab ones that match your scheme (i.e. Ignore and APIPA addresses or the LocalHost address). You could say to grab the address matching 192.168.200.* for example.

    $IPv4Addr = Get-NetIPAddress -AddressFamily ipV4 | where {$_.IPAddress -like X.X.X.X} | Select IPAddress
    

提交回复
热议问题