Created
March 4, 2016 16:17
-
-
Save tomtorggler/c045d8c9da7b74fb84e0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# create CimSessions to each of the servers to be configured | |
$cimSessions = New-CimSession -ComputerName n01,n02,n03,n04 | |
# foreach CimSession configure an IPv4 Address on the interface with Alias Ethernet 2 | |
# the IP Address is derived from the ComputerName property of the CimSession | |
$cimSessions | ForEach-Object { | |
$params = @{ | |
IPAddress = "192.168.1."+$PSItem.ComputerName.Substring(2,1); | |
InterfaceAlias = 'Ethernet 2'; | |
PrefixLength = '24'; | |
AddressFamily = 'IPv4'; | |
CimSession = $PSItem | |
} | |
New-NetIPAddress @params | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment