Fix: Commented shitty Client creation on create-all

This commit is contained in:
Alexandre Simao 2021-06-30 16:42:57 +02:00
parent 3f633c9f25
commit 934f90ee1d
2 changed files with 57 additions and 40 deletions

View File

@ -182,47 +182,48 @@ 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
#### 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
$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"

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
}