Skip to main content

Remotely Enable and Assign Static IPv6 Addresses to a List of Devices

Are you ready for IPv6 and have a need to enable and apply static IPv6 addresses to a list of devices remotely?  We have recently been tasked to do just that on our servers, since we now have our infrastructure and applications ready for IPv6 and can now take full advantage of all the benefits it brings.   But the challenge is, we have close to a hundred servers in our department alone, and I was not about to login to each server and get carpal tunnel from clicking and typing around...  So, I wrote a simple script that would help us, and hopefully it will help others too :).

The script is fairly simple...  It remotely enables IPv6 (if it isn't already) and apply the given IPv6 static addresses you assign accordingly based on the list you specify in the CSV format.   If the target device has multiple NICs, it only assigns the static address to the given NIC name you provide in the param section (see $DedicatedNIC).  It also detects whether you have NIC teaming enabled and once again, it only applies the static address to the given name of that Teamed NIC you specify in the param section (see $DedicatedTeamNic).  Additionally, it creates a log for you in the same folder where the script is for monitoring the progress.

.USAGE
    Set-Static-IPv6.ps1 -CsvFile <path to the csv file> -PrefixLength <PrefixLength> -PreferredDNS <Primary IPV6DNS Address> -AlternateDNS <Alternate IPV6DNS Address>

    CSV file format:
        Name,IPAddv6,GateWay
        <Hostname1>,<IPV6Address>,<IPV6Gateway>
        <Hostname2>,<IPV6Address>,<IPV6Gateway>
 
NOTE:  The prefix length, the DNS addresses, and the NIC card(s) you're targeting are preset in the param section.  You can change them using the switches or they can also be moved to be part of the CSV, if need be.  Especially for the DNS addresses...  You may have multiple of them, but in our case we only have two, so presetting them in the param section made sense.
Oh, and use it at your own risk! :) :) :)
 
param(
 [string]$CsvFile,
    [string]$PrefixLength = "64",
    [string]$PreferredDNS = "xxxx:xxx:xxxx:xxxx::1111",
    [string]$AlternateDNS = "xxxx:xxx:xxxx:xxxx::1112",
    [string]$DedicatedTeamNIC = "Team",
    [string]$DedicatedNIC = "Ethernet"
)
 

- --> Click HERE to download the script. <---

Congrats on being IPv6 ready!  :) :) :)

  • Created on .