$ip = <NanoServerPublicIPAddress>
Set-Item wsman:\localhost\Client\TrustedHosts -Value $ip
$s = New-PSSession -ComputerName $ip -Credential $ip\Administrator
Enter-PSSession $s
Add-Content -Path .\unattendIIS.xml -Value '<?xml version="1.0" encoding="utf-8"?>'
Add-Content -Path .\unattendIIS.xml -Value '<unattend xmlns="urn:schemas-microsoft-com:unattend">'
Add-Content -Path .\unattendIIS.xml -Value ' <servicing>'
Add-Content -Path .\unattendIIS.xml -Value ' <package action="install">'
Add-Content -Path .\unattendIIS.xml -Value ' <assemblyIdentity name="Microsoft-NanoServer-IIS-Package" version="10.0.10586.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" />'
Add-Content -Path .\unattendIIS.xml -Value ' <source location="c:\packages\Microsoft-NanoServer-IIS-Package.cab" />'
Add-Content -Path .\unattendIIS.xml -Value ' </package>'
Add-Content -Path .\unattendIIS.xml -Value ' <package action="install">'
Add-Content -Path .\unattendIIS.xml -Value ' <assemblyIdentity name="Microsoft-NanoServer-IIS-Package" version="10.0.10586.0" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="en-US" />'
Add-Content -Path .\unattendIIS.xml -Value ' <source location="c:\packages\en-us\Microsoft-NanoServer-IIS-Package.cab" />'
Add-Content -Path .\unattendIIS.xml -Value ' </package>'
Add-Content -Path .\unattendIIS.xml -Value ' </servicing>'
Add-Content -Path .\unattendIIS.xml -Value ' <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />'
Add-Content -Path .\unattendIIS.xml -Value '</unattend>'
dism /online /apply-unattend:.\unattend.xmlThe process may require a restart of Nano Server, at least it did in my case. Once the server was back up, which doesn't take very long, I created a new index.html file:
Add-Content -Path C:\inetpub\wwwroot\index.html -Value "<HTML><BODY><H1>Hello World</H1></BODY></HTML>"Now if I go to the public IP address of my Nano Server, I should see the webpage. And I do! That gives us a basis for working through other scenarios like configuring the Nano Server as a container host. In fact... that will be my next post.
Labels: Azure, powershell, Windows Nano Server, Windows Server 2016