Fix: VHD Mounting on VM

This commit is contained in:
Alexandre Simao 2021-06-30 17:17:38 +02:00
parent ca84d9a6e9
commit 1e2b87f298
2 changed files with 14 additions and 5 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

@ -29,7 +29,7 @@ Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
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"
@ -62,7 +62,7 @@ Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
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"
@ -97,7 +97,7 @@ Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
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"
@ -137,7 +137,7 @@ Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.
Dismount-VHD "$env:VHD_PATH$vm_name.vhdx"
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
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"
@ -172,7 +172,7 @@ Copy-item "${env:SCRIPTS_PATH}Guests\$vm_name.ps1" "${Drive}\Tools\scripts\boot.
Dismount-VHD $env:VHD_PATH$vm_name.vhdx
New-VM -Name "$vm_name" -generation "$gen" -memorystartupbytes $mem
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"