PowerShell is a cross-platform task automation solution consisting of a command-line shell, scripting language, and configuration management framework. It runs on Windows, Linux, and macOS. We can use PowerShell to automate the creation, modification, and deletion of websites in IIS. To create a new website in IIS through PowerShell, you need to perform the following steps.
Step 1: Search for PowerShell in the Windows Server/Windows system. Once you get the result, right-click on it and select the option Run as administrator to open the application with administrator rights.
Step 2: Enter the following command in PowerShell to load the Web Administration Module.
# Import-Module webadministration

Step 3: You need to create a folder or file for the website in the drive. New-Item is a quick and easy way to create new files or folders on the system. For example, you create a new directory in the C drive, i.e., C:\inetpub\nicktest.com.
# New-Item C:\inetpub\nicktest.com -type directory

You can use the following command to create a file in the drive.
# New-Item C:\inetpub\nicktest.com\index.html -type file

Step 4: Enter the following command to create a website in IIS using PowerShell. New-Item is also used to create new Websites within the IIS PowerShell.
# New-Item iis:\Sites\nicktest.com -bindings @{protocol="http";bindingInformation=":80:nicktest.com"}
-physicalPath C:\inetpub\nicktest.com\

Step 5: To check whether the website is created or not, enter the following command in PowerShell. You can see that the website nicktest.com was created successfully.
# Get-Website

Let's verify the same website from the IIS
Step 1: Search for IIS (Internet Information Service Manager) in the Windows Server/Windows system and click on it.
Step 2: Click on the Server name, and then click on the Sites option. You will get the list of websites hosted on the IIS. You can see that the website nicktest.com has been successfully created.
That's all.