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:
1 2 3 | Import-Module WebAdministration New-Item -type directory -path d:\iis\mikefrobbins New-Website -Name "mikefrobbins" -Port 80 -IPAddress "192.168.1.222" -PhysicalPath d:\iis\mikefrobbins -ApplicationPool "ASP.NET v4.0" |
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:
µ
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?