Scripts/WDSandMDT.ps1


#############################################################
# #
# Hyper-V config #
# #
#############################################################

New-HyperVAutopilotVM -VMName MDT01 -Path G:\Hyper-V\ -IsoFile F:\WindowsImaging\Customers\ALL\SERVER_EVAL_x64FRE_en-us\General\ALL_SERVER_EVAL_x64FRE_en-us_General.iso -vSwitch Ext -RAM 8 -Connect
Set-VMResolution MDT01 1920x1200
Start-VM MDT01
# Dismount-AllVmDvds


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

$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"





#############################################################
# #
# Server config #
# #
#############################################################


Rename-Computer -NewName "MDT"
Install-Module JaapsTools -force

Remove-WindowsFeature Windows-Defender

Install-WindowsFeature WDS -IncludeAllSubFeature -IncludeManagementTools -Restart


Install-WindowsFeature NFS-Client -IncludeAllSubFeature -IncludeManagementTools -Restart
Connect-NAS01
Copy-Item M:\RAM\Jaap\OneDrive\MDT\MDT.zip C:\Users\Administrator\Downloads\
Copy-Item M:\RAM\Jaap\OneDrive\MDT\wds.zip C:\Users\Administrator\Downloads\


# Rename DVD driveletter
New-MyVolume -Disk 1 -DriveLetter D

Get-Service WDSServer | Stop-Service
# Copy files
Get-Service WDSServer | Start-Service

New-LocalUser wds -Password (ConvertTo-SecureString "wds" -AsPlainText -Force) -PasswordNeverExpires -UserMayNotChangePassword
Add-LocalGroupMember -Group administrators -Member wds

choco install mdt
choco install windows-adk-all

Set-ImagingVariables
New-ImagingFolders
exit
Write-AutounattendFiles

Import-Module 'C:\Program Files\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1'

# New-SmbShare -Path D:\MDT\Buildshare\ -Name Buildshare$ -FullAccess Everyone