From b2cb2eaae623b750036b23fdd2ed56cf1f8a75fa Mon Sep 17 00:00:00 2001 From: Alexandre S Date: Mon, 10 May 2021 14:41:49 +0200 Subject: [PATCH] Feat: First draft of client scripts --- Host/Clients.ps1 | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Host/Clients.ps1 diff --git a/Host/Clients.ps1 b/Host/Clients.ps1 new file mode 100644 index 0000000..5b500dd --- /dev/null +++ b/Host/Clients.ps1 @@ -0,0 +1,69 @@ +## 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 +Copy-Item d:\Unattend\CLI-01.xml -Destination e:\Windows\Panther\Unattend.xml +mkdir e:\Tools\Scripts +Copy-item d:\Scripts\Guests\CLI-01.ps1 E:\Tools\scripts +Dismount-VHD d:\VHD\CLI-01.vhdx + +$vms = @{ + + Name = "CLI-01" + Generation = '2' + 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' +Set-VMNetworkAdapter -VMName 'CLI-01' -Name "Arc-CLI" -DeviceNaming on + + +### 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 +Copy-Item d:\Unattend\CLI-01.xml -Destination e:\Windows\Panther\Unattend.xml +mkdir e:\Tools\Scripts +#Copy-item d:\Scripts\Guests\CLI-03.ps1 E:\Tools\scripts +Dismount-VHD d:\VHD\CLI-03.vhdx + +$vms = @{ + + Name = "CLI-03" + Generation = '2' + 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' +Set-VMNetworkAdapter -VMName 'CLI-03' -Name "Bou-LAN" -DeviceNaming on + +### Starting VMS +echo "Starting VMs" +Start-VM -Name RTR* +Start-VM -Name SRV*