From 15350d508aef1b4039474e0ccbe6fbc2bda97ad6 Mon Sep 17 00:00:00 2001 From: Winston Smith Date: Wed, 21 Apr 2021 15:00:09 +0200 Subject: [PATCH] Before Mac refactor --- Host/Infra-Standard.ps1 | 20 +++++++++++++------- Memo.ps1 | 8 +++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Host/Infra-Standard.ps1 b/Host/Infra-Standard.ps1 index f261cc4..1e3ddb5 100644 --- a/Host/Infra-Standard.ps1 +++ b/Host/Infra-Standard.ps1 @@ -27,7 +27,6 @@ New-VM @vms Set-VMMemory SRV-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB $vmadapter = Get-VMNetworkAdapter -VMName "SRV-01" Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -StaticMacAddress 00155D027000 -# Endregion SRV-01 # RTR-01 @@ -68,14 +67,17 @@ $vms = @{ Generation = '2' MemoryStartupBytes = 1024Mb VHDPath = "d:\VHD\$VMName.vhdx" - SwitchName = 'Arc-SRV' + SwitchName = 'Bou-LAN' } New-VM @vms + Set-VMMemory RTR-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB -#Add-VMSwitch -Name "WAN" -ResourcePoolName "WAN" -Add-VMNetworkAdapter -VMName RTR-02 -SwitchName "WAN" -StaticMacAddress 00155D027004 -Add-VMNetworkAdapter -VMName RTR-02 -SwitchName "Bou-LAN" -StaticMacAddress 00155D027005 + +$vmadapter = Get-VMNetworkAdapter -VMName "RTR-01" +Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -StaticMacAddress 00155D027004 +Add-VMNetworkAdapter -VMName RTR-02 -SwitchName "WAN" -StaticMacAddress 00155D027005 + # RTR-03 @@ -92,13 +94,17 @@ $vms = @{ Generation = '2' MemoryStartupBytes = 1024Mb VHDPath = "d:\VHD\$VMName.vhdx" + SwitchName = 'WAN' } New-VM @vms + Set-VMMemory RTR-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB -Add-VMNetworkAdapter -VMName RTR-03 -SwitchName "Aston" -StaticMacAddress 00155D027006 -Add-VMNetworkAdapter -VMName RTR-03 -SwitchName "WAN" -StaticMacAddress 00155D027007 + +$vmadapter = Get-VMNetworkAdapter -VMName "RTR-01" +Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -StaticMacAddress 00155D027006 +Add-VMNetworkAdapter -VMName RTR-03 -SwitchName "Aston" -StaticMacAddress 00155D027007 Start-VM -Name RTR* diff --git a/Memo.ps1 b/Memo.ps1 index dd35e56..a64c543 100644 --- a/Memo.ps1 +++ b/Memo.ps1 @@ -1,4 +1,4 @@ -#$VMNetAdap = Get-VMNetworkAdapter -VMName RTR-01|ft -Property Switchname,Macaddress -HideTableHeaders +#$VMNetAdap = Get-VMNetworkAdapter -VMName RTR-01|ft -Property Switchname,Macaddress -HideTableHeaders Get-VMNetworkAdapter -VMName RTR-01|Format-Table -Property Switchname,Macaddress -HideTableHeaders |Export-Csv D:\scripts\Guests\MACS\test.csv -NoTypeInformation #echo $VMNETADAP | out-file -FilePath D:\scripts\Guests\MACS\temp.txt @@ -27,3 +27,9 @@ $adapter | New-NetIPAddress ` -DefaultGateway $Gateway # Configure the DNS client server IP addresses $adapter | Set-DnsClientServerAddress -ServerAddresses $DNS + + +Get-VMNetworkAdapter -VMName "Virtual 2008 1" | Where-Object -Property MacAddress -eq "00155D647100" | Rename-VMNetworkAdapter -NewName "vNIC1" + +Get-NetAdapter |Where-Object {$_.MacAddress -eq 'XX-XX-XX-XX'} | Select-Object` +-Property Name | Format-Table -HideTableHeaders