Create a New IIS Website with PowerShell

On a Windows Server 2008 R2 machine, IIS has already been installed and you want to create an additional website. If necessary, an additional IP Address has been added to the server also.

Use the New-Website PowerShell cmdlet to accomplish this task:

You can get a list of websites running on the server by using the Get-Website cmdlet or by running Get-ChildItem on the IIS PSDrive:


1 Comment

  1. Alan

    Hi,when i’ll execute line “New-Website” return a exception:

    System.Management.Automation.CmdletInvocationException: Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) —> System.Runtime.InteropServices.COMException: Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
    at Microsoft.IIs.PowerShell.Framework.Interop.IAppHostProperty.get_Value()
    at Microsoft.IIs.PowerShell.Framework.ConfigurationElement.GetPropertyValue(IAppHostProperty property)

    But, it works, you know how to fix this exception?


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: