powershell-query host name and IP address

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.