Below is how I get it.
$SPSiteServerRelativeUrl = $site.ServerRelativeUrl
$SPWebServerRelativeUrl = $web.ServerRelativeUrl
$SPWebSiteRelativeUrl = ""
if ($web.IsRootWeb -eq $false)
{
$SPWebSiteRelativeUrl = $SPWebServerRelativeUrl.Replace($SPSiteServerRelativeUrl + "/", "")
}
Write-Host "SPWebSiteRelativeUrl=$SPWebSiteRelativeUrl" -f DarkYellow
No comments:
Post a Comment