From 8f9a10a680315dd569d4bb5825be1c3bc67c3296 Mon Sep 17 00:00:00 2001 From: Alexandre Simao Date: Mon, 28 Jun 2021 17:23:52 +0200 Subject: [PATCH] Feat: Add var + env var in bootstrap --- Host/Bootstrap-Hyper-V.ps1 | 39 ++++++++++++++++++++++++++++++++------ temp/1.ps1 | 2 ++ temp/2.ps1 | 1 + 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 temp/1.ps1 create mode 100644 temp/2.ps1 diff --git a/Host/Bootstrap-Hyper-V.ps1 b/Host/Bootstrap-Hyper-V.ps1 index 8440d83..cb4d363 100644 --- a/Host/Bootstrap-Hyper-V.ps1 +++ b/Host/Bootstrap-Hyper-V.ps1 @@ -1,9 +1,36 @@ -New-Item -Path "d:\" -Name "VHD" -ItemType "directory" -New-Item -Path "d:\" -Name "VM" -ItemType "directory" -New-Item -Path "d:\VHD" -Name "Base" -ItemType "directory" -Move-Item d:/sources d:/VHD/ -New-VHD -ParentPath d:\VHD\source\Base_2016_14393.161220_StdGUI_G2_upd28022017.vhdx -Path d:\VHD\Base\Base_SRV_diff.vhdx -Differencing -New-VHD -ParentPath d:\VHD\source\Master_Win10_20h2_x86_G1.vhdx -Path d:\VHD\Base\Base_CLI_diff.vhdx -Differencing +# Bootstrap script to init Hyper-v + +echo "Shamefully made by Alexandre Simao. Pardon-me dear M. Stallman" +echo "GPLv3" + +### Define variables + +$scripts_path = Read-host "Scripts path?" +$vhd_path = Read-host "VHD path?" +$vm_path = Read-Host "VM path?" +$source_path = Read-host "Actual source path?" +$base_srv = Read-Host "SRV base disk name without extension?" +$base_cli = Read-Host "CLI base disk name without extension?" + +### Store them as ENV vars + +$env:SCRIPTS_PATH = ${scripts_path} +$env:VHD_PATH = ${vhd_path} +$env:VM_PATH = ${vm_path} +$env:SOURCE_PATH = ${source_path} +$env:BASE_SRV = ${base_srv} +$env:BASE_CLI = ${base_cli} + +### Let the fuckery begins! + +md ${vhd_path} +md ${vhdpath}\Base +md ${vm_path} + +Move-Item ${source_path} ${vhd_path} + +New-VHD -ParentPath ${vhd_path}\source\${base_srv}.vhdx -Path ${vhd_path}\Base\Base_SRV_diff.vhdx -Differencing +New-VHD -ParentPath ${vhd_path}\source\${base_cli}.vhdx -Path ${vhd_path}\Base_CLI_diff.vhdx -Differencing ### Create VMNetworks New-VMSwitch -name Arc-CLI -SwitchType Private diff --git a/temp/1.ps1 b/temp/1.ps1 new file mode 100644 index 0000000..365cbda --- /dev/null +++ b/temp/1.ps1 @@ -0,0 +1,2 @@ +$cul = "tamere" +d:\scripts\temp\2.ps1 \ No newline at end of file diff --git a/temp/2.ps1 b/temp/2.ps1 new file mode 100644 index 0000000..f0f5321 --- /dev/null +++ b/temp/2.ps1 @@ -0,0 +1 @@ +echo $cul \ No newline at end of file