Powershell Script to Set Computer Name Based on DNS

This Powershell script will use nslookup to query a DNS Server to get the hostname and use that result to set the computer name.

If you use this you will need to amend as necessary including the address of the DNS Server (I have added the Google one here for illustration) and I am filtering to ensure I get a single IP address on my machine starting with 123.* (again for illustration).

You may first need to allow execution of unsigned scripts:

Then run the script:

 

 

 

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">