Home » PowerShell » PowerShell Remove WebSite from IIS Server

PowerShell Remove WebSite from IIS Server

Use the PowerShell Remove-IISSite cmdlet to remove a website from the IIS server. The Remove-IISSite command removes a website specified by the Name parameter.

Here, is the Remove-IISSite syntax that deletes a site from an IIS server.

Remove-IISSite
      [-Name] <String>
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

The Name parameter specifies the name of the website that you want to delete from an IIS server.

The following PowerShell script will remove a site from the IIS server.

Remove-IISSite -Name "HMI"

In the above PowerShell script, the Remove-IISSite command uses the Name parameter to remove a website named “HMI” from an IIS server.

Kindly note, that if the website doesn’t exist on the Internet Information Services (IIS) server, the above command will display a warning as “WARNING: Web site does not exist.”

Conclusion

I hope the above article on how to remove a website from the IIS server using the PowerShell Remove-IISSite cmdlet is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Articles

Create a new web application

Create a new website

Get all websites and applications in IIS

Check IIS Status