none
Get absolute URL when calling Get-SPWeb through PowerShell

    Question

  • Hi,


    I'm trying to get the absolute url for the sites under my site collection (ex http://developer/sites/test).

    This is what i get: http://developer/sites/test/testsite

    This is what i want to get: http://developer/sites/test/testsite/default.aspx

    THE CODE:
    $url = "http://developer/sites/test"
    $site = Get-SPWeb ($url)

    foreach ($web in $site.Site.AllWebs)
    {
        'Title: ' + $web.Title
    $web.Url
    }

    Is this possible? I've tried to google, but I can only find answers regarding SPLists and such.

    Please help!

    Thanks in advance!

    Tuesday, November 26, 2013 9:39 AM

Answers

  • This is what i get: http://developer/sites/test/testsite

    This is what i want to get: http://developer/sites/test/testsite/default.aspx

    It is not clear what exactly you want to do. But default.aspx is the Home page(Welcome page). You can read this using PowerShell like -

    $web = Get-SPWeb -Identity "http://developer/sites/test"
    $rootFolder = $web.RootFolder
    $wp = $rootFolder.WelcomePage
    $wp

    Thanks

    Tuesday, November 26, 2013 1:04 PM

All replies

  • can you explain what you want to achieve from that. your try to do something with home page of each site?
    Tuesday, November 26, 2013 10:34 AM
  • This is what i get: http://developer/sites/test/testsite

    This is what i want to get: http://developer/sites/test/testsite/default.aspx

    It is not clear what exactly you want to do. But default.aspx is the Home page(Welcome page). You can read this using PowerShell like -

    $web = Get-SPWeb -Identity "http://developer/sites/test"
    $rootFolder = $web.RootFolder
    $wp = $rootFolder.WelcomePage
    $wp

    Thanks

    Tuesday, November 26, 2013 1:04 PM