Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Error in Powershell script to create XML sitemap

  Date: Sep 17    Category: Sharepoint    Views: 1172

Trying to loop through the site collection to get all sites:

$site=Get-SPSite $Url
$list = $site.Allwebs | ForEach { $_.Lists } | ForEach-Object -Process
{$_.Items}| ForEach-Object -Process {$_.web.url.Replace(" ","%20") + "/" +
$_.url.Replace(" ","%20")}

It works for some site collection, but some site collection return 0 sites.

when we try to run $list = $site.Allwebs for those SC, it return nothing.

Any idea?



2 Answers Found

Answer #1    Answered On: Sep 17    

What user context are you running under? The operation is going to be
security trimmed based on that, maybe those sites are not accessible by
the process UID?

Answer #2    Answered On: Sep 17    

I just run in in Powershell scripts with Local Administrator permission. How can
I check if those site are accessible by Process UID?
Or any other alternatives?

Didn't find what you were looking for? Find more on Error in Powershell script to create XML sitemap Or get search suggestion and latest updates.