↑ Return to Top
# Import New-NanoServerImage PowerShell Module for Technical Preview 4
Import-Module `
-Global C:\NanoServer\NanoServerImageGenerator.psm1 ;
# Create New Basic NanoServer Image with IIS for Technical Preview 4 with IIS and ReverseForwarders Package
New-NanoServerImage `
-MediaPath "Z:" `
-BasePath "C:\NanoServer\Base" `
-TargetPath "C:\NanoServer\WS16TP4NSIIS1\WS16TP4NSIIS1.vhd" `
-EnableRemoteManagementPort `
-Language "en-us" `
-GuestDrivers `
-DriversPath "C:\NanoServer\VMware-Drivers" `
-Packages "Microsoft-NanoServer-IIS-Package, Microsoft-OneCore-ReverseForwarders-Package" `
-Ipv4Address "192.168.100.25" `
-Ipv4SubnetMask "255.255.255.0" `
-Ipv4Gateway "192.168.100.3" `
-DomainBlobPath "C:\NanoServer\WS16TP4NSIIS1.djoin" `
-AdministratorPassword (ConvertTo-SecureString -String "Password" -AsPlainText -Force) ;
# Establish a remote PowerShell Session to the Nano Server
Enter-PSSession `
-ComputerName 192.168.100.24 `
-Credential (New-Object `
-TypeName System.Management.Automation.PSCredential `
-ArgumentList "192.168.100.24\Administrator", `
(ConvertTo-SecureString `
-String "Password" `
-AsPlainText `
-Force) `
) ;
# Create a Packages folder in Nano Server
New-Item `
-Path "C:\Packages" `
-Type directory ;
# Create an en-us language folder for Packages folder in Nano Server
-Path "C:\Packages\en-us" `
# Exit PowerShell Session
Exit-PSSession ;
# Show PowerShell version for Copy-Item
$PSVersionTable ;
# Copy ReverseForwarders Package from DVD to Nano Server remotely
Copy-Item `
-Path "D:\NanoServer\Packages\Microsoft-OneCore-ReverseForwarders-Package.cab" `
-Destination "\\192.168.100.24\C$\Packages" ;
-Path "D:\NanoServer\Packages\en-us\Microsoft-OneCore-ReverseForwarders-Package.cab" `
-Destination "\\192.168.100.24\C$\Packages\en-us" ;
# Add ReverseForwarder package to Nano Server
dism /online /add-package /packagepath:C:\Packages\Microsoft-OneCore-ReverseForwarders-Package.cab
# Add en-us language ReverseForwarder package to Nano Server
dism /online /add-package /packagepath:C:\Packages\en-us\Microsoft-OneCore-ReverseForwarders-Package.cab
# Restart the Nano Server remotely
Restart-Computer -Force ;
# Create a Temp folder
-Path "C:\Temp" `
# Download HttpPlatformHandler v1.2 x64 to C:\Temp
Invoke-WebRequest `
-Uri "http://go.microsoft.com/fwlink/?LinkId=690721" `
-OutFile "C:\Temp\httpPlatformHandler_amd64.msi" ;
# Verify HttpPlatformHandler v1.2 x64 has been downloaded
Get-ChildItem `
-Path "C:\Temp\httpPlatformHandler_amd64.msi" ;
# Extract httpPlatformHandler v1.2 x64 MSI Files
Start-Process `
-FilePath msiexec.exe `
-ArgumentList "/a C:\Temp\httpPlatformHandler_amd64.msi /qb TARGETDIR=C:\Temp\httpPlatformHandler_v1.2_amd64" `
-Wait `
-PassThru ;
# Copy the HttpPlatformHandler.dll file
# from extracted folder to Nano Server remotely
-Path "C:\Temp\httpPlatformHandler_v1.2_amd64\inetsrv\HttpPlatformHandler.dll" `
-Destination "\\192.168.100.24\C$\Windows\System32\inetsrv" ;
# Copy the httpplatform_schema.xml file
-Path "C:\Temp\httpPlatformHandler_v1.2_amd64\inetsrv\config\schema\httpplatform_schema.xml" `
-Destination "\\192.168.100.24\C$\Windows\System32\inetsrv\config\schema" ;
# Import IIS Administration PowerShell Module
Import-Module IISAdministration ;
# Add AppSettings section (for Asp.Net Core)
(Get-IISServerManager).GetApplicationHostConfiguration().RootSectionGroup.Sections.Add("appSettings") ;
# Unlock handlers section
(((Get-IISServerManager).GetApplicationHostConfiguration()).GetSection("system.webServer/handlers")).OverrideMode = "Allow" ;
# Add httpPlatform section to system.webServer
((Get-IISServerManager).GetApplicationHostConfiguration().RootSectionGroup.SectionGroups["system.webServer"].Sections.Add("httpPlatform")).OverrideModeDefault = "Allow" ;
# Add httpPlatformHandler.dll to globalModules
New-IISConfigCollectionElement `
-ConfigCollection (Get-IISConfigSection "system.webServer/globalModules" | Get-IISConfigCollection) `
-ConfigAttribute @{"name"="httpPlatformHandler";"image"="%SystemRoot%\system32\inetsrv\httpPlatformHandler.dll"} ;
# Add httpPlatformHandler module to modules
-ConfigCollection (Get-IISConfigSection "system.webServer/modules" | Get-IISConfigCollection) `
-ConfigAttribute @{"name"="httpPlatformHandler"} ;
# Commit Changes on IIS Server Manager
(Get-IISServerManager).CommitChanges() ;
# Create a folder
-Path "C:\ASP-Site" `
-Path "C:\ASP-Site\wwwroot" `
# Create a new IIS Website for ASP.NET 5
New-IISSite `
-Name "ASP-on-NanoServer" `
-BindingInformation "*:5004:asp.nanoserver.naboo.co.nz" `
-PhysicalPath "C:\ASP-Site\wwwroot" ;
# Allow HTTP 5004 through Windows Firewall
New-NetFirewallRule `
-Name "AspNetCore" `
-DisplayName "HTTP on TCP/5004" `
-Protocol tcp `
-LocalPort 5004 `
-Action Allow `
-Enabled True ;
# Verify the new IIS Site is created
(Get-IISServerManager).Sites
Excellent work ! Keep going. I'm looking forward your next topic !
Maybe a dumb/newbie question but : Is this possible to have other IIS modules working in Nano Server ? Or in the future ? Like URL Rewrite or ARR ?
Hi Nathanael,
Unfortunately, Windows Server 2016 Nano Server is still in Technical Preview 4 while I'm responding to you and I'm unable to provide you any definitive detail if it is possible on Nano Server. Stay tune to TechNet Wiki for more Nano Server articles as we explore. Thank you for your support. :)
What you can do is to cast your support vote to let Microsoft be aware of those feature requests using the URLs below:
1. Support of URL Rewrite for IIS
-- windowsserver.uservoice.com/.../13611888-support-of-url-rewrite-2-0-for-iis-on-nano-server
2. Support of ARR for IIS
-- windowsserver.uservoice.com/.../13611660-support-of-application-request-routing-arr-3-for