Compare commits

...

No commits in common. "master" and "refacto_bootstrap+create_all" have entirely different histories.

7 changed files with 253 additions and 145 deletions

View File

@ -201,5 +201,14 @@ echo "Add local DNS for all Hosts"
Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 192.168.8.1
Get-DhcpServerv4Scope | Set-DhcpServerv4OptionValue -DnsServer 192.168.128.1
# Install Active-Directory
install-windowsfeature AD-Domain-Services -includemanagementtools -includeallsubfeature
# Configure Active-Dir
Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath C:\Windows\NTDS -DomainMode Win2016 -DomainName localdomain -DomainNetbiosName ad.localdomain -ForestMode Win2016 -InstallDns:$false -LogPath C:\Windows\NTDS -NoRebootOnCompletion:$false -SysvolPath C:\Windows\SYSVOL -Force:$true
Read-Host "Finished?"
Restart-Computer

View File

@ -1,6 +1,49 @@
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
$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?"
$vhd_path = Read-host "VHD path with trailling slash?"
$vm_path = Read-Host "VM path with trailling slash?"
### Store them as ENV vars
$env:BASE_CLI_NAME = ${base_cli}
$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}
$env:VM_PATH = ${vm_path}
$env:VHD_PATH = ${vhd_path}
### 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_name}.vhdx -Path ${vhd_path}\Base\${base_srv_name}.vhdx -Differencing
New-VHD -ParentPath ${vhd_path}\source\${source_cli_name}.vhdx -Path ${vhd_path}\${base_cli_name}.vhdx -Differencing
### Create VMNetworks
New-VMSwitch -name Arc-CLI -SwitchType Private
New-VMSwitch -name Arc-SRV -SwitchType Private
New-VMSwitch -name Bou-LAN -SwitchType Private
New-VMSwitch -name WAN -SwitchType Private
New-VMSwitch -name Aston -NetAdapterName Ethernet -AllowManagementOS $true

View File

@ -5,184 +5,227 @@ echo "GPLv3"
### Considered as finished. Need improvement VM side.
### Define vars
$scripts_path = d:\scripts
### Adding SRV-01
echo "Adding and configuring SRV-01"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\SRV-01.vhdx
$vm_name = "SRV-01"
$switch_name = "Arc-SRV"
$gen = 2
$mem = 1024MB
$min_mem = 512MB
$max_mem = 2048MB
$cpus = 2
$Lettre = Mount-VHD -Path "d:\VHD\SRV-01.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
echo "Adding and configuring $vm_name"
cp "$env:BASE_VHD_PATH$env:BASE_SRV_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 + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
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}deploy.cmd" -Destination "${Drive}\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item ${scripts_path}\Guests\SRV-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\SRV-01.vhdx
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
$vms = @{
Name = "SRV-01"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-01.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
Set-VMMemory SRV-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name SRV-01 -ProcessorCount 2
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem -VHDPath "$env:VHD_PATH$vm_name.vhdx"
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 'SRV-01' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'SRV-01' -Name "Arc-SRV" -DeviceNaming on
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName "$switch_name"
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
### Adding SRV-03
echo "Adding and configuring SRV-03"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\SRV-03.vhdx
$vm_name = "SRV-03"
$switch_name = "Arc-SRV"
$gen = 2
$mem = 1024MB
$min_mem = 512MB
$max_mem = 2048MB
$cpus = 2
$Lettre = Mount-VHD -Path "d:\VHD\SRV-03.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
echo "Adding and configuring $vm_name"
cp "$env:BASE_VHD_PATH$env:BASE_SRV_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 + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
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}deploy.cmd" -Destination "${Drive}\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item ${scripts_path}\Guests\SRV-03.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\SRV-03.vhdx
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
$vms = @{
Name = "SRV-03"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\SRV-03.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
Set-VMMemory SRV-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name SRV-03 -ProcessorCount 2
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem -VHDPath "$env:VHD_PATH$vm_name.vhdx"
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 'SRV-03' -NewName 'Bou-LAN'
Set-VMNetworkAdapter -VMName 'SRV-03' -Name "Bou-Lan" -DeviceNaming on
Rename-VMNetworkAdapter -VMName "$vm_name" -NewName "$switch_name"
Set-VMNetworkAdapter -VMName "$vm_name" -Name "$switch_name" -DeviceNaming on
### Adding and configuring RTR-01
echo "Adding and configuring RTR-01"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\RTR-01.vhdx
$vm_name = "RTR-01"
$switch_name = "Arc-CLI"
$switch_name2 = "Arc-SRV"
$switch_name3 = "WAN"
$gen = 2
$mem = 1024MB
$min_mem = 512MB
$max_mem = 2048MB
$cpus = 2
$Lettre = Mount-VHD -Path "d:\VHD\RTR-01.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
echo "Adding and configuring $vm_name"
cp "$env:BASE_VHD_PATH$env:BASE_SRV_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 + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
$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}deploy.cmd" -Destination "${Drive}\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item ${scripts_path}\Guests\RTR-01.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\RTR-01.vhdx
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
$vms = @{
Name = "RTR-01"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\RTR-01.vhdx"
SwitchName = "Arc-SRV"
}
New-VM @vms
Set-VMMemory RTR-01 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name RTR-01 -ProcessorCount 2
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem -VHDPath "$env:VHD_PATH$vm_name.vhdx"
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"
#Set-VMNetworkAdapter -VMNetworkAdapter $vmadapter[0] -Name "Arc-SRV" -DeviceNaming on
Rename-VMNetworkAdapter -VMName 'RTR-01' -NewName 'Arc-SRV'
Set-VMNetworkAdapter -VMName 'RTR-01' -Name "Arc-SRV" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-01" -SwitchName "Arc-CLI" -Name "Arc-Cli" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-01" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
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
# RTR-02
echo "Adding and configuring RTR-02"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\RTR-02.vhdx
$vm_name = "RTR-02"
$switch_name = "Bou-LAN"
$switch_name2 = "WAN"
$gen = 2
$mem = 1024MB
$min_mem = 512MB
$max_mem = 2048MB
$cpus = 2
$Lettre = Mount-VHD -Path "d:\VHD\RTR-02.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
echo "Adding and configuring $vm_name"
cp "$env:BASE_VHD_PATH$env:BASE_SRV_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 + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
>>>>>>> parent of ca6ee46 (Feat: Add VNetwork creation)
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}deploy.cmd" -Destination "${Drive}\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item ${scripts_path}\Guests\RTR-02.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\RTR-02.vhdx
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
$vms = @{
Name = "RTR-02"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\RTR-02.vhdx"
SwitchName = "Bou-LAN"
}
New-VM @vms
Set-VMMemory RTR-02 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name RTR-02 -ProcessorCount 2
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem -VHDPath "$env:VHD_PATH$vm_name.vhdx"
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 'RTR-02' -NewName 'Bou-Lan'
Set-VMNetworkAdapter -VMName 'RTR-02' -Name "Bou-LAN" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-02" -SwitchName "WAN" -Name "WAN" -DeviceNaming on
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
# RTR-03
echo "Adding and configuring RTR-03"
cp D:\VHD\Base\Base_SRV_diff.vhdx D:\VHD\RTR-03.vhdx
$vm_name = "RTR-03"
$switch_name = "Aston"
$switch_name3 = "WAN"
$gen = 2
$mem = 1024MB
$min_mem = 512MB
$max_mem = 2048MB
$cpus = 2
$Lettre = Mount-VHD -Path "d:\VHD\RTR-03.VHDx" -PassThru | Get-Disk | Get-Partition | Get-Volume | Sort-Object -Property Size -Descending | Select-Object -First 1
echo "Adding and configuring $vm_name"
cp "$env:BASE_VHD_PATH$env:BASE_SRV_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 + ":"
Copy-Item D:\Scripts\Unattend\FullUnattend-srv.xml -Destination "$Drive\Windows\Panther\Unattend.xml"
Copy-Item D:\Scripts\deploy.cmd -Destination "${Driveletter}:\conf\deploy.cmd"
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}deploy.cmd" -Destination "${Drive}\conf\deploy.cmd"
mkdir "${Driveletter}:\Tools\Scripts"
Copy-item ${scripts_path}\Guests\RTR-03.ps1 "${Driveletter}:\Tools\scripts\boot.ps1"
Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.ps1"
Dismount-VHD d:\VHD\RTR-03.vhdx
Dismount-VHD $env:VHD_PATH$vm_name.vhdx
$vms = @{
Name = "RTR-03"
Generation = '2'
MemoryStartupBytes = 1024Mb
VHDPath = "d:\VHD\RTR-03.vhdx"
SwitchName = "WAN"
}
New-VM @vms
Set-VMMemory RTR-03 -DynamicMemoryEnabled $true -MinimumBytes 512MB -StartupBytes 1024MB -MaximumBytes 2GB
Set-VM -Name RTR-03 -ProcessorCount 2
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem -VHDPath "$env:VHD_PATH$vm_name.vhdx"
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 'RTR-03' -NewName 'WAN'
Set-VMNetworkAdapter -VMName 'RTR-03' -Name "WAN" -DeviceNaming on
Add-VMNetworkAdapter -VMName "RTR-03" -SwitchName "Aston" -Name "Aston" -DeviceNaming on
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"
Start-VM -Name RTR*

View File

@ -87,3 +87,19 @@ Add-DnsServerSecondaryZone -ComputerName $SecondaryDNSServer2 -MasterServers [Sy
Get-WindowsCapability -name "*RSAT*" -online|Add-WindowsCapability -online
Import-Csv .\new_employees.csv | ForEach-Object {
New-ADUser `
-Name $($_.FirstName + " " + $_.LastName) `
-GivenName $_.FirstName `
-Surname $_.LastName `
-Department $_.Department `
-State $_.State `
-EmployeeID $_.EmployeeID `
-DisplayName $($_.FirstName + " " + $_.LastName) `
-Office $_.Office `
-UserPrincipalName $_.UserPrincipalName `
-SamAccountName $_.SamAccountName `
-AccountPassword $(ConvertTo-SecureString $_.Password -AsPlainText -Force) `
-Enabled $True
}

View File

@ -1,12 +1,14 @@
# Aston Hyper-V code snipets
## Introduction
title: Aston Hyper-V Code Snippets
# Introduction
As a student at Aston Informatic School we mainly, and until now, exclusively studies Microsoft products.
Because I like to tinker, you'll find here some tools to put an infra in place.
For the moment, no Ansible, no Chef-Infra, no Terraform; no nice feature at all. I hope to resolve that later.
To achieve this ambitious goal, i'll use mainly PowerShell scripts.
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
# Usage
First of all, here be dragons.
@ -17,15 +19,13 @@ The host folder contain all scripts needed for deploying the infra.
* 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
# 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 radiance of the Microsoft "hegemony"
* Richard M. Stallman for his work and his wise teachings
* Sylvain Arrambourg, for his teachings and patience.
# 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.
* Go to hell Microsoft, may you eternally burn and take with you corporate greed and private code.
## Licence
GPLv3 my dudes!
* Fuck Microsoft, may you burn in fire and take with you corporate greed and all privater code.

View File

@ -1,2 +0,0 @@
$cul = "tamere"
d:\scripts\temp\2.ps1

View File

@ -1 +0,0 @@
echo $cul