Aston-HyperV-Code/Host/Clients.ps1

83 lines
2.7 KiB
PowerShell
Raw Normal View History

2021-05-10 14:41:49 +02:00
## Tool to automate VM creation
echo "Shamefully made by Alexandre Simao. Pardon-me dear M. Stallman"
echo "GPLv3"
### Considered as finished. Need improvement VM side.
### Adding CLI-01
echo "Adding and configuring CLI-01"
cp D:\VHD\Base\Base_Client_dif.vhdx D:\VHD\CLI-01.vhdx
Mount-VHD d:\VHD\CLI-01.vhdx
2021-06-01 10:18:07 +02:00
<<<<<<< HEAD
2021-05-31 12:32:19 +02:00
Copy-Item d:\Scripts\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
2021-06-01 10:18:07 +02:00
=======
2021-05-12 16:25:20 +02:00
Copy-Item d:\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
2021-06-01 10:18:07 +02:00
>>>>>>> DNS
2021-05-10 14:52:26 +02:00
#mkdir e:\Tools\Scripts
2021-05-10 14:48:42 +02:00
#Copy-item d:\Scripts\Guests\CLI-01.ps1 E:\Tools\scripts
2021-05-12 10:58:01 +02:00
mkdir "f:\Program Files\BGINFO"
2021-05-12 10:47:38 +02:00
Copy-Item d:\Soft\BGInfo_Deploiement\BGInfo.exe "f:\Program Files\BGINFO"
Copy-Item d:\Soft\BGInfo_Deploiement\mescouilles2.bgi "f:\Program Files\BGINFO"
2021-05-12 14:20:31 +02:00
Copy-Item D:\Soft\BGInfo_Deploiement\bginfox86.bat "f:\Users\AdminLocal\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
2021-05-10 14:41:49 +02:00
Dismount-VHD d:\VHD\CLI-01.vhdx
$vms = @{
Name = "CLI-01"
2021-05-10 14:52:26 +02:00
Generation = '1'
2021-05-10 14:41:49 +02:00
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\CLI-01.vhdx"
SwitchName = "Arc-CLI"
}
New-VM @vms
Set-VMMemory CLI-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name CLI-01 -ProcessorCount 2
echo "Configuring adapters"
Rename-VMNetworkAdapter -VMName 'CLI-01' -NewName 'Arc-CLI'
### Adding and configuring CLI-03
echo "Adding and configuring CLI-03"
cp D:\VHD\Base\Base_Client_dif.vhdx D:\VHD\CLI-03.vhdx
Mount-VHD d:\VHD\CLI-03.vhdx
2021-06-01 10:18:07 +02:00
<<<<<<< HEAD
2021-05-31 12:32:19 +02:00
Copy-Item d:\Scripts\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
2021-06-01 10:18:07 +02:00
=======
2021-05-12 16:25:20 +02:00
Copy-Item d:\Unattend\Fullunattend-Win10.xml -Destination f:\Windows\Panther\Unattend.xml
2021-06-01 10:18:07 +02:00
>>>>>>> DNS
2021-05-10 14:52:26 +02:00
#mkdir e:\Tools\Scripts
2021-05-10 14:41:49 +02:00
#Copy-item d:\Scripts\Guests\CLI-03.ps1 E:\Tools\scripts
2021-05-12 10:58:01 +02:00
mkdir "f:\Program Files\BGINFO"
2021-05-12 14:20:31 +02:00
Copy-Item d:\Soft\BGInfo_Deploiement\BGInfox86.exe "f:\Program Files\BGINFO"
2021-05-12 10:47:38 +02:00
Copy-Item d:\Soft\BGInfo_Deploiement\mescouilles2.bgi "f:\Program Files\BGINFO"
2021-05-12 14:20:31 +02:00
Copy-Item D:\Soft\BGInfo_Deploiement\bginfox86.bat "f:\Users\AdminLocal\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
2021-05-10 14:41:49 +02:00
Dismount-VHD d:\VHD\CLI-03.vhdx
$vms = @{
Name = "CLI-03"
2021-05-10 14:52:26 +02:00
Generation = '1'
2021-05-10 14:41:49 +02:00
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\CLI-03.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
Set-VMMemory CLI-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name CLI-03 -ProcessorCount 2
echo "Configuring adapters"
#Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -Name "Bou-LAN" -DeviceNaming on
Rename-VMNetworkAdapter -VMName 'CLI-03' -NewName 'Bou-LAN'
### Starting VMS
echo "Starting VMs"
2021-05-10 14:52:26 +02:00
Start-VM -Name CLI*