Last active
August 29, 2015 14:25
-
-
Save iconnor/4e962673d78a8b02b0e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ip=((gwmi Win32_NetworkAdapterConfiguration | ? { $_.IPAddress -ne $null }).ipaddress | select -First 1) | |
$ipAddressName = $ip.Replace(".","-") | |
If ($env:COMPUTERNAME -eq $ipAddress) { echo $ipAddressName; echo "No need to change" } else { netdom renamecomputer "$env:COMPUTERNAME" /Newname $ipAddressName /REBoot 10 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment