mkvm.ps1 s-adm s-infra r-int r-ext rustique

This commit is contained in:
Anthony Arnoux 2023-01-30 11:53:59 +01:00
parent b04ae4302b
commit ea4166590b

128
scripts/mkvm.ps1 Normal file
View File

@ -0,0 +1,128 @@
#mkvm pour toutes les vms
$mkvmrelease="v1.2"
$ovarelease="2023a"
$ovafogrelease="2023a"
$ovafile="$HOME\Downloads\debian-bullseye-gsb-${ovarelease}.ova"
$ovafilefog="$HOME\Downloads\debian-buster-gsb-${ovafogrelease}.ova"
$deletemode=0
if ($args[0] -eq "s-adm") {
#Importation depuis l'ova
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" import "$ovafile" --vsys 0 --vmname "s-adm"
#création de la première interface
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --nic1 bridged
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --nictype1 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --cableconnected1 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --nicpromisc1 allow-all
#création de la deuxième interface
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --nic2 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --intnet2 "n-adm"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --nictype2 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --cableconnected2 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-adm" --nicpromisc2 allow-all
}
elseif ($args[0] -eq "s-infra") {
#Importation depuis l'ova
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" import "$ovafile" --vsys 0 --vmname "s-infra"
#création de la première interface
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --nic1 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --intnet1 "n-adm"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --nictype1 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --cableconnected1 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --nicpromisc1 allow-all
#création de la deuxième interface
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --nic2 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --intnet2 "n-infra"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --nictype2 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --cableconnected2 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "s-infra" --nicpromisc2 allow-all
}
elseif ($args[0] -eq "r-int") {
#Importation depuis l'ova
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" import "$ovafile" --vsys 0 --vmname "r-int"
#interface 1
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nic1 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --intnet1 "n-adm"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nictype1 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --cableconnected1 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nicpromisc1 allow-all
#interface 2
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nic2 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --intnet2 "n-link"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nictype2 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --cableconnected2 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nicpromisc2 allow-all
#interface 3
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nic3 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --intnet3 "n-wifi"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nictype3 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --cableconnected3 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nicpromisc3 allow-all
#interface 4
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nic4 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --intnet4 "n-user"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nictype4 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --cableconnected4 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nicpromisc4 allow-all
#interface 5
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nic5 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --intnet5 "n-infra"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nictype5 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --cableconnected5 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-int" --nicpromisc5 allow-all
}
elseif ($args[0] -eq "r-ext") {
#Importation depuis l'ova
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" import "$ovafile" --vsys 0 --vmname "r-ext"
#interface 1
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nic1 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --intnet1 "n-adm"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nictype1 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --cableconnected1 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nicpromisc1 allow-all
#interface 2
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nic2 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --intnet2 "n-dmz"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nictype2 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --cableconnected2 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nicpromisc2 allow-all
#interface 3
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nic3 bridged
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nictype3 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --cableconnected3 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nicpromisc3 allow-all
#interface 4
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nic4 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --intnet4 "n-linkv"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nictype4 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --cableconnected4 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nicpromisc4 allow-all
#interface 5
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nic5 intnet
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --intnet5 "n-link"
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nictype5 82540EM
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --cableconnected5 on
& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyvm "r-ext" --nicpromisc5 allow-all
}