In my last post Setup Nano Server as NAS for Home Lab I showed you how to get started with Nano Server. In that post I used one 150GB disk, but in this post I’m going to show you how to configure Data Deduplication and local WSUS.
In case you missed it I highly recommend you checking out Automate WSUS on Windows 2016 Server Core and How To Clean Up WSUS which have saved customers terabytes of storage.
Let’s get started!
In this example we’re going to create a VHD of 8GB for the OS. Date Deduplication cannot run on the system drive so more space isn’t needed.
After you’ve created and imported the VHD add a new disk and start the VM.
I’m going to break the different commands into sections and at the end you find the complete PowerShell script.
Connect to the host:
1 2 |
Set-Item WSMan:\localhost\Client\TrustedHosts * Enter-PSSession -ComputerName 192.168.2.203 -Credential Administrator |
Initialize the disk, create partition and format the new disk:
1 2 3 |
Initialize-Disk -Number 1 New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter D Format-Volume -DriveLetter D |
Add Deduplication feature and enable it on D drive:
1 2 |
dism /online /enable-feature /featurename:dedup-core /all Enable-DedupVolume -Volume D:\ -UsageType Default |
Add Scheduled Task to run Deduplication:
1 |
new-DedupSchedule -Name "Nano Optimization" -Type Optimization -Days Monday,Wednesday,Friday -Start 23:00 -DurationHours 8 |
Create Folders and Shares:
1 2 3 4 5 |
New-Item -Type Directory D:\Shares New-Item -Type Directory D:\Shares\ISO New-Item -Type Directory D:\Shares\MEDIA New-SmbShare –Name ISO –Path D:\Shares\ISO -FullAccess Administrator New-SmbShare –Name MEDIA –Path D:\Shares\MEDIA -FullAccess Administrator |
Configure to use Internal WSUS:
1 2 3 4 5 6 7 8 |
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate -Name WUServer -PropertyType String -Value http://wsus-01:8530 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate -Name WUStatusServer -PropertyType String -Value http://wsus-01:8530 New-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate -Name AU New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name AUOptions -PropertyType Dword -Value 4 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name UseWUServer -PropertyType Dword -Value 1 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name ScheduledInstallTime -PropertyType Dword -Value 3 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name ScheduledInstallDay -PropertyType Dword -Value 0 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name NoAutoUpdate -PropertyType Dword -Value 0 |
These are the registry keys equal to my Group Policy settings.
The complete script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
Set-Item WSMan:\localhost\Client\TrustedHosts * Enter-PSSession -ComputerName 192.168.2.203 -Credential Administrator Initialize-Disk -Number 1 New-Partition -DiskNumber 1 -UseMaximumSize -DriveLetter D Format-Volume -DriveLetter D dism /online /enable-feature /featurename:dedup-core /all Enable-DedupVolume -Volume D:\ -UsageType Default new-DedupSchedule -Name "Nano Optimization" -Type Optimization -Days Monday,Wednesday,Friday -Start 23:00 -DurationHours 8 New-Item -Type Directory D:\Shares New-Item -Type Directory D:\Shares\ISO New-Item -Type Directory D:\Shares\MEDIA New-SmbShare –Name ISO –Path D:\Shares\ISO -FullAccess Administrator New-SmbShare –Name MEDIA –Path D:\Shares\MEDIA -FullAccess Administrator New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate -Name WUServer -PropertyType String -Value http://wsus-01:8530 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate -Name WUStatusServer -PropertyType String -Value http://wsus-01:8530 New-Item -Path Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate -Name AU New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name AUOptions -PropertyType Dword -Value 4 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name UseWUServer -PropertyType Dword -Value 1 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name ScheduledInstallTime -PropertyType Dword -Value 3 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name ScheduledInstallDay -PropertyType Dword -Value 0 New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WindowsUpdate\AU -Name NoAutoUpdate -PropertyType Dword -Value 0 |