-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlastoctet - Copy.ps1
More file actions
35 lines (20 loc) · 879 Bytes
/
lastoctet - Copy.ps1
File metadata and controls
35 lines (20 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
$allhosts = "9zxtresxsc02.usfqa.adqa.usfood.local"
foreach($onehost in $allhosts) {
$allhostsip = Test-Connection $allhosts -Count 1 | select IPV4Address | ft -HideTableHeaders
$LastOctet = $allhostsip.
$LastOctet
}
Get-VsanDisk
foreach($onehost in $onehostss) {
Get-VDSwitch -Name vDS-$2DigCodeName"-sc-DVUplinks" | Add-VDSwitchVMHost -VMHost $onehost
sleep 7
}
foreach($onehost in $allhosts) {
$IP4Address = Test-Connection -Computer $onehost -Count 1 | Select IPV4Address -ExpandProperty IPV4Address
$test1 = ([ipaddress]$IP4Address).GetAddressBytes()[3]
$static3 ="10.10.10."
$newvmotion = $static3 + $test1
$newvmotion
New-VMHostNetworkAdapter -VMHost $onehost -PortGroup pg-$2DigCodeName"-vmotion" -VirtualSwitch vDS-$2DigCodeName"-sc-DVUplinks" -IP $newvmotion -SubnetMask 255.255.255.0 -VMotionEnabled:$true
}