DOS query IP address and host name information:
1.ipconfig | Find "IPv4"
2.hostname
3.systeminfo |find "host name:"
Default many people are always accustomed to use DOS command query, in fact PowerShell implementation is very simple. As follows:
PowerShell queries IP address and hostname information:
1.foreach ($IPV 4 in (ipconfig)-like ' *ipv4* ') {($IPV 4-split ': ') [-1]}
2.get-wmiobject Win32_ComputerSystem |select Name
3. $env: COMPUTERNAME
PS. Originally thought of directly to the accumulation of two years to organize into articles, but out of respect for the readers, after careful consideration, or decided to re-dome the environment and to Server2016 as the basis for the series of related articles. There may be a lot of readers wondering whether there will be outdated or shared with other authors before the issue of repetition, in view of such problems, Xiao Wen just want to say that Wing at each end of a technical direction is always like to follow their own understanding and practice of sorting out some technical articles or technical aspects, to facilitate the reader or himself later to read or re-study. Occasionally share small dos, PowerShell, or mail-related simple commands or tricks. Thanks for your support!
powershell-query host name and IP address