-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIteradorVlans.ps1
22 lines (15 loc) · 970 Bytes
/
IteradorVlans.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$VLANS = Import-Csv -Path "E:\Scripts\VLANS.csv" -Delimiter ";"
foreach($mVlan in $VLANS){
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "VLAN ID" -DisplayValue $mVlan.VLAN
Get-NetAdapter Ethernet0 | Remove-NetIPAddress -AddressFamily IPv4 -Confirm:$false
Get-NetAdapter Ethernet0 | Remove-NetRoute -AddressFamily IPv4 -Confirm:$false
Get-NetAdapter Ethernet0 | New-NetIPAddress -AddressFamily IPv4 -IPAddress $mVlan.IP -PrefixLength $mVlan.Prefix -DefaultGateway $mVlan.Gateway
sleep -Seconds 5
$Gateway = $mVlan.Gateway
$VLANindex = $mVlan.VLAN
Invoke-Pester -Script @{ Path = "E:\Scripts\Ping.test.ps1"; Parameters = @{Gateway = $Gateway; VLAN = $mVlan.VLAN}} -OutputFile "e:\scripts\Result_Test_$VLANindex.xml" -OutputFormat LegacyNUnitXml
}
###Doc the process
# You need a New machine.
# Start the process of the script.
# Send the XML result to analizer logs for the indexation and monitoring.