locked
How to stop only one site RRS feed

  • Question

  • Hello,

    Can I use powershell to stop only one iis site and leave other sites running? If I stop a site and reboot my server that site will be running. I need to stop it permanently. How to do that? 


    • Edited by _WEAREBORG_ Thursday, October 12, 2017 11:17 AM
    Thursday, October 12, 2017 11:17 AM

Answers

  • Hi,

    This will do the trick

    $site = Get-Item 'IIS:\sites\<site name>'
    $site.serverAutoStart = $False
    $site.Stop()


    Please remember to mark the replies as answers if they help.,

    NEDIMMEHIC.ORG

    • Proposed as answer by I.T Delinquent Thursday, October 12, 2017 11:24 AM
    • Marked as answer by _WEAREBORG_ Thursday, October 12, 2017 12:33 PM
    Thursday, October 12, 2017 11:23 AM
  • Import-Module ServerManager
    
    Add-WindowsFeature Web-Scripting-Tools
    
    Import-Module WebAdministration
    Run these 3 commands and try again

    Please remember to mark the replies as answers if they help.,

    NEDIMMEHIC.ORG

    • Marked as answer by _WEAREBORG_ Thursday, October 12, 2017 12:33 PM
    Thursday, October 12, 2017 11:32 AM

All replies

  • Thank you but it is not working

    Get-Item : Cannot find drive. A drive with the name 'IIS' does not exist.
    At line:1 char:9
    + $site = Get-Item 'IIS:\sites\<Default Web Site'
    +         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (IIS:String) [Get-Item], DriveNotFoundException
        + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetItemCommand

    Thursday, October 12, 2017 11:27 AM