How can I stop and start individual websites in IIS using PowerShell?

前端 未结 4 1574
北荒
北荒 2020-12-13 01:57

I have multiple sites configured in IIS7 on my Windows 7 development machine to run on the same port and usually only run one at a time depending on what I\'m working on. I

4条回答
  •  执念已碎
    2020-12-13 02:08

    I found that the following to stop individual websites on a remote server to work:

    Invoke-Command -Computername $servername -Scriptblock { 
        (Import-Module WebAdministration); 
        Stop-Website -Name "WebsiteName"; 
        Stop-Website -Name "AnotherWebsiteName"
    }
    

    I had some of the errors above until Import-Module was put in ()

提交回复
热议问题