none
List of Sites and Application pools in IIS RRS feed

  • Question

  • Hi Team ,

    How to get the list of sites and application pools in my IIS console in the server using powershell

    Regards,

    Devendra


    MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful

    Monday, December 17, 2012 7:10 AM

Answers

  • Hi,

    According to the error message, I would like suggest you split your code into steps to troubleshoot this issue:

     Run

    [void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
     to load the proper assemly

    Then run
    $iis = New-Object Microsoft.Web.Administration.ServerManager

     to define the variable $iis

    please also run $iis | get-member  to list all properties and methods could be used.

    After that check out whether the property named "sites" is listed out. If it is listed out, then run

    $items = $iis.sites

    Regards,

    Yan Li

    If you have any feedback on our support, please click here .


    Cataleya Li
    TechNet Community Support

    Thursday, December 20, 2012 2:35 AM
    Moderator

All replies

  • After loading WebAdministration module:

    Get-ChildItem IIS:\sites

    Get-ChildItem IIS:\apppools

    Monday, December 17, 2012 7:30 AM
  • Hi,

    Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.

    If you have any feedback on our support, please click here .


    Cataleya Li
    TechNet Community Support

    Wednesday, December 19, 2012 5:39 AM
    Moderator
  • Hi Blindrood /Yan,

    I am trying to execute the below command to list the details in PS1 file. but i am getting error.

    [void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
    
    $iis = New-Object Microsoft.Web.Administration.ServerManager
    
    
     $items = Invoke-Expression "$iis.Sites"
    
    or 
    
    $items = Invoke-Expression "$iis.Sites |Format-Table name"

    "Microsoft.Web.Administration.ServerManager.Sites : The term 'Microsoft.Web.Administration.ServerManager.Sites' is
    not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
    or if a path was included, verify that the path is correct and try again"

    Thanks


    MCTS,MCPD Sharepoint 2010. My Blog- http://www.sharepoint-journey.com
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful

    Wednesday, December 19, 2012 7:00 AM
  • Hi,

    According to the error message, I would like suggest you split your code into steps to troubleshoot this issue:

     Run

    [void] [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
     to load the proper assemly

    Then run
    $iis = New-Object Microsoft.Web.Administration.ServerManager

     to define the variable $iis

    please also run $iis | get-member  to list all properties and methods could be used.

    After that check out whether the property named "sites" is listed out. If it is listed out, then run

    $items = $iis.sites

    Regards,

    Yan Li

    If you have any feedback on our support, please click here .


    Cataleya Li
    TechNet Community Support

    Thursday, December 20, 2012 2:35 AM
    Moderator
  • Hi,

    Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.

    If you have any feedback on our support, please click here .


    Cataleya Li
    TechNet Community Support

    Monday, December 24, 2012 1:50 AM
    Moderator
  • Show!
    Wednesday, January 13, 2016 1:16 PM