We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

restart remote websites [Answered]RSS

2 replies

Last post Oct 14, 2009 05:50 AM by rkr31

  • restart remote websites

    Oct 06, 2009 11:12 AM|amackan|LINK

    Hi, running iis7 on our network. i need to write a script that will stop a particular website on our internal web server and the associated apppool. we currently use iisweb to do this on our iis6 server.


    can some one point me in the right direction. my desktop pc is vista 32 bit running powershell 1 with the IIS7 powershell tools installed.



  • Re: restart remote websites

    Oct 13, 2009 12:00 AM|Leo Tang - MSFT|LINK


    Please check the following article:

    How Can I Use Windows PowerShell to Start a Service on a Remote Computer?

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us

  • Re: restart remote websites

    Oct 14, 2009 05:50 AM|rkr31|LINK

    Here is one i created to do the same.  Just pass it the name of your site (It assumes that your pool is the same name as the site. )

    ### Get the parameters from the command line

    ### Import all the modules we need
    Import-module WebAdministration | out-null

    ### Restart the site
    Restart-WebItem iis:\sites\$sitename
    Restart-WebItem iis:\apppools\$sitename