4

I need to get the all site collection and subsite information. But for the properties , I need root site collection owner, subsite URL, subsite Name.

Get-SPWebApplication | Get-SPSite -Limit all | Get-SPWeb -Limit all | Select Title, URL, Owner | Export-CSV "path" -NoTypeInformation

This script does not give me primary site collection owner name.

2 Answers 2

4

A SPSite doesn't contain a Title property and a SPWeb doesn't have an Owner property. You need to split your PowerShell into two different execution rows, like this

Get-SPWebApplication | Get-SPSite -Limit all | Select URL, Owner
Get-SPWebApplication | Get-SPSite -Limit all | Get-SPWeb -Limit all | Select Title, URL

This might look strange, but the root site collection (SPSIte) also contain a SPWeb, where the Title property lives. That's why you'll get two result rows, one for the SPSite (with the owner) and one for the SPWeb (with the Title).

1

Try below code:

Get-SPSite -Limit All | 
  Get-SPWeb -Limit All | 
  where { $_.HasUniquePerm } | 
  foreach { $TTNweburl = $_.Url; $_ } | 
  Select -ExpandProperty Users | 
  Where { $_.IsSiteAdmin } | 
  Select {$TTNweburl}, UserLogin, DisplayName

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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