Microsoft IIS 10.0 – Uploading website pages

How to Create Swap File on Ubuntu 19.10 & 19.04

In this recipe, we are going to upload website pages to; we will create the default.htm file using PowerShell.

Getting ready

To step through this recipe, you will need a Nano Server 2016 instance with the IIS package installed. For all this installation and configuration work, you should have administrative privileges.

How to do it…

  1. Go to the WIN2016IIS server. To access Nano Server 2016, we have to first log in to the WIN2016IIS server (any Windows Server 2016 or Windows 10 machine will do); we will use our WIN2016IIS server to remotely connect with Nano Server Before going to access the Nano Server c$ share, you should configure the firewall on Nano Server to allow file and print service options.
  2. Open the file explorer on WIN2016IIS server, and type\c$\inetpub\wwwroot\nanosite in the address bar. It will prompt you for the administrator password of your Nano Server instance. Once you provide the correct password, the Nano Server instance will open to\c$\inetpub\wwwroot\nanosite.
  3. Copy the default IIS Server IISStart.htm and IISSstart.png files from c:\inetpub\wwwroot and paste them in the physical Nanosite website folder,\c$\inetpub\wwwroot\nanosite. This is one option we can use to upload website pages. I will show you a much easier option to create a simple web page for testing purposes.
  4. Connect to Nano Server through PowerShell with administrator rights.



  1. Run Import-module iisadministration. After this, you can create a web page through PowerShell using the following commands:

      "Welcome to IIS on Nano Server by Ashraf Khan This" | Out-File -PSPath 

"Welcome to IIS on Nano Server by Ashraf Khan This" is the text that will be displayed on the web page, and Out-file -PSPath is used to define the type of file and physical path of your website. You can see this in the following screenshot:

  1. So we’ve just written a single line of easy code to create an HTML webpage. Let’s check the nanosite folder and see whether the file has been created.



  1. Open\c$\inetpub\wwwroot\nanosite. As shown in this screenshot, the default.htm file has been created:

How it works…

In this recipe, we uploaded default IIS website pages IISStart.htm and IISStart.png to the nanosite folder, which is located in the Nano Server C:\inetpub\wwwroot\nanosite folder. We created the default.htm file through PowerShell and verified that the file was created in the folder.

Comments are closed.