5

In a system, when I run

Get-SPSite | Get-SPWeb

It shows the error:

Get-SPWeb : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

But if I run

$sites = get-spsite ;
foreach ($site in $sites)
{
    Write-Host 'Processing ' $site;
    get-spweb $site.Url
} 

Everything works fine.

Anyone knows what can cause this issue?

UAC is Off, obviously, the account has permission to run the cmdlet, what else it can be? Any idea?

Thanks

  • you are running this against the same site collection url? get-spsite sitecollection naem | get-spweb – Waqas Sarwar MVP Jun 16 '15 at 16:54
  • yes, same site collection – urlreader Jun 16 '15 at 18:37
  • how many site collections you have? did you try with supplying the url as i mentioned – Waqas Sarwar MVP Jun 16 '15 at 18:42
  • can not try it, since do not know the collection name. this code will run in different environment, and site collection are different. I'm just wondering why '|' not working. – urlreader Jun 16 '15 at 19:01
  • Get-spsite will try to get all site collections and may be you have no access on it. – Waqas Sarwar MVP Jun 16 '15 at 19:05
3

When you do

Get-SPSite | Get-SPWeb

You will get a collection of all SPSites in the farm, and then you try to pass this array as an argument to get all SPWebs. The pipe | is only valid if you pass a single object (one SPSite) to the next operation. And that is exactly what you're doing in your second example. To get the first statement to work, you have to pass only one SPSite to get its SPWebs.

You need to type:

Get-SPSite -Identity https://MySiteCollectionURL | Get-SPWeb

In your second attempt you're only getting the root SPWeb which has the same URL as the Site Collection. You're not getting all SPWebs in that SPSite.

0

Please refer to the below link https://technet.microsoft.com/en-us/library/cc263291.aspx

which says..................... Farm Administrators group Members of the Farm Administrators group have Full Control permissions to and responsibility for all servers in the server farm. Members can perform all administrative tasks in Central Administration for the server or server farm. They can assign administrators to manage service applications, which are instances of shared services. This group does not have access to individual sites or their content. ................................

So, you have to grant user policy for each web app (full read). regards, Nicholas A. Souza

  • the account has been granted full read permission, same issue. even with full control permission, same issue. weird. – urlreader Jun 22 '15 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.