Scripts/HyperV.ps1


Set-VMProcessor -VMName HV01 -ExposeVirtualizationExtensions $true



$VMName = "MDT01"
$DriveLetter = "D"
$Size = "50GB"

$Path = "G:\Hyper-V\MDT01\Virtual Hard Disks"
Set-Location $Path

New-VHD -Path "$($VMName)-$($DriveLetter).vhdx" -SizeBytes $Size #-Fixed

Add-VMHardDiskDrive -VMName $VMName -Path "$($VMName)-$($DriveLetter).vhdx"

Get-VMHardDiskDrive -VMName $VMName



# Use Windows Powershell!!!

Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-Tools-All -NoRestart -Online -All



# Add VM adapter to host
Add-VMNetworkAdapter -ManagementOS -SwitchName AP


# Nog testen
New-VMSwitch -Name AP -SwitchType Internal
Get-NetAdapter
New-NetIPAddress -IPAddress 192.168.100.1 -PrefixLength 24 -InterfaceIndex 28
New-NetNat -Name Nat-Switch-Outside -InternalIPInterfaceAddressPrefix 192.168.100.0/24
Get-NetNat