So I was looking at blog example code to display the site collection lock status of all site collections on a farm.
When I ran the code, 2 of the site collections didn't display a title. I modified it slightly to get the info. Here's what I have right now.
Add-pssnapin Microsoft.SharePoint.Powershell -ErrorAction silentlycontinue
$siteResult = @()
$sites = get-spsite -limit all | foreach {
$objResult = New-Object System.Object
$objResult | Add-Member -type NoteProperty -name SiteName -value $_.RootWeb.Title
$objResult | Add-Member -type NoteProperty -name siteURL -value $_.Rootweb.URL
if ($_.ReadOnly -eq $false -and $_.ReadLocked -eq $false -and $_.WriteLocked -eq $false) {
$objResult | Add-Member -type NoteProperty -Name Status -value "Unlocked"
}
if ($_.ReadOnly -eq $false -and $_.ReadLocked -eq $false -and $_.WriteLocked -eq $true) {
write-host "trap1"
$objResult | Add-Member -type NoteProperty -Name Status -value "Adding Content Prevented"
}
if ($_.ReadOnly -eq $true -and $_.ReadLocked -eq $false -and $_.WriteLocked -eq $true) {
$objResult | Add-Member -type NoteProperty -Name Status -value "Read-Only"
}
if ($_.ReadOnly -eq $null -and $_.ReadLocked -eq $null -and $_.WriteLocked -eq $null) {
$objResult | Add-Member -type NoteProperty -Name Status -value "No Access"
}
if ($_.lockissue -ne $null) {
$objResult | Add-Member -type NoteProperty -Name LockInfo -value $_.LockIssue
}
$siteResult += $objresult
}
$siteResult | format-list
This showed me the URL of the site collections without a title.
So I went to the site collection to add a title.
However, when I go into Site Actions > Site Settings > Title, description and icon , I find that page displays a title for the site collection.
In fact, when I created the site collection on a specfic content database, there was a property for providing a title, which I provided and which now displays there.
Is there something wrong with the script above that is preventing the title from being displayed? Or am I missing some step?
Thank you!