Feat: Add README.md
This commit is contained in:
parent
3a3a330dde
commit
3f633c9f25
@ -9,6 +9,7 @@ $base_cli = Read-Host "CLI base disk name with extension?"
|
||||
$base_srv = Read-Host "SRV base disk name with extension?"
|
||||
$base_vhd_path = "${vhd_path}Base\"
|
||||
$scripts_path = Read-host "Scripts path with trailling slash?"
|
||||
$soft_path = Read "Software path with trailling slash?"
|
||||
$source_cli_name = Read-Host "CLI source disk name with extension?"
|
||||
$source_path = Read-host "Actual source path with trailling slash?"
|
||||
$source_srv_name = Read-Host "SRV source disk name with extension?"
|
||||
@ -22,6 +23,7 @@ $env:BASE_SRV_NAME = ${base_srv}
|
||||
$env:BASE_VHD_PATH = ${base_vhd_path}
|
||||
$env:FULL_PATH = ${full_path}
|
||||
$env:SCRIPTS_PATH = ${scripts_path}
|
||||
$env:SOFT_PATH = ${soft_path}
|
||||
$env:SOURCE_CLI_NAME = ${source_cli_name}
|
||||
$env:SOURCE_PATH = ${source_path}
|
||||
$env:SOURCE_SRV_NAME = ${source_srv_name}
|
||||
|
@ -182,6 +182,47 @@ Rename-VMNetworkAdapter -VMName "$vm_name" -NewName "$switch_name"
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$switch_name2" -Name "$switch_name2" -DeviceNaming on
|
||||
|
||||
### Adding and configuring CLI-01
|
||||
|
||||
$vm_name = "CLI-01"
|
||||
$switch_name = "Arc-CLI"
|
||||
$gen = 1
|
||||
$mem = 512MB
|
||||
$min_mem = 512MB
|
||||
$max_mem = 1024MB
|
||||
$cpus = 2
|
||||
|
||||
echo "Adding and configuring $vm_name"
|
||||
cp "$env:BASE_VHD_PATH$env:BASE_CLI_NAME" "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
$Lettre = Mount-VHD -Path $env:VHD_PATH$vm_name.VHDx -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
|
||||
$DriveLetter = $Lettre.DriveLetter
|
||||
$drive = "$DriveLetter" + ":"
|
||||
New-Item -Path "${Driveletter}:\conf\" -Name "Base" -ItemType "directory"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}Unattend\FullUnattend-srv.xml" -Destination "$Drive\Windows\Panther\Unattend.xml"
|
||||
Copy-Item "${env:SCRIPTS_PATH}deploy.cmd" -Destination "${Drive}\conf\deploy.cmd"
|
||||
mkdir "${Driveletter}:\Tools\Scripts"
|
||||
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
|
||||
|
||||
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
|
||||
|
||||
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
|
||||
Set-VMHardDiskDrive -VMName "$vm_name" -Path "$env:VHD_PATH$vm_name.vhdx" -ControllerType SCSI
|
||||
Set-VMMemory "$vm_name" -DynamicMemoryEnabled $true -MinimumBytes $min_mem -StartupBytes $mem -MaximumBytes $max_mem
|
||||
Set-VM -Name "$vm_name" -ProcessorCount "$cpus"
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName "$switch_name"
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
|
||||
echo "Configuring adapters"
|
||||
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName "$switch_name"
|
||||
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$switch_name2" -Name "Arc-SRV" -DeviceNaming on
|
||||
Add-VMNetworkAdapter -VMName "$vm_name" -SwitchName "$switch_name3" -Name "WAN" -DeviceNaming on
|
||||
### Starting VMS
|
||||
|
||||
echo "Starting VMs"
|
||||
|
31
README.md
Normal file
31
README.md
Normal file
@ -0,0 +1,31 @@
|
||||
title: Aston Hyper-V Code Snippets
|
||||
|
||||
# Introduction
|
||||
|
||||
As a student at Aston Informatic School we mainly, and until now, exclusively studies Microsoft products.
|
||||
As i feel that i'm in a strange marketing course for the evil mega-corporation, i'll try to pass the time quicker and focus on some side projects like the FreeIPA integration on a cursed Windows network.
|
||||
To do that, i need to make the infra-building as quick as possible.
|
||||
No Ansible, no Chef-Infra, no Terraform; no nice feature as all.
|
||||
To achieve this ambitious goal, i'll use the ill-named PowerShell scripts.
|
||||
|
||||
# Usage
|
||||
|
||||
First of all, here be dragons.
|
||||
|
||||
The host folder contain all scripts needed for deploying the infra.
|
||||
* Bootstrap-Hyper-V.ps1 copy the necessary files (diff disks etc) on the desired folders. It will configure automaticaly all aspects to launch VMs on this atrocious Hyper-v.`v1`
|
||||
* Create-ALL.ps1 create all VMs with adequate parameters to comply with the school pre-defined infrastructure. It consist on 2 server on a separate network that does AD, DNS, DHCP for one and nothing for the other at the time.`v1`
|
||||
* Create-SRV.ps1 creates only the poor servers, fixed parameters for the moment.
|
||||
* Create-CLI.ps1 create only the cursed client, same ase Create-SRV.ps1.
|
||||
* SRV-Kill.ps1 cease the suffering of the servers.
|
||||
* ALL-Kill.ps1 cease all the travesty of infrastructure.
|
||||
# TODO
|
||||
* Integrate SRV-02 creation and role definition.
|
||||
* Variable isinde Create-SRV.ps1, Create-CLI.ps1.
|
||||
* Unmount disk on Kill scripts.
|
||||
# Credit roll
|
||||
* Sorry to the free-software community for, in a way, increasing the dummyradiance of the Microsoft
|
||||
* Richard M. Stallman for his teachings and his wize-wizardness
|
||||
* Sylvain Arrambourg, for his teachings.
|
||||
* Well, of course my familly, beloved ones and my cat.
|
||||
* Fuck Microsoft, may you burn in fire and take with you corporate greed and all privater code.
|
Loading…
Reference in New Issue
Block a user