Showing posts with label Site Collections. Administrator. Show all posts
Showing posts with label Site Collections. Administrator. Show all posts

Thursday, January 11, 2018

Find out all Site Collection Administrators from a Web Application using PowerShell


clear
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.Powershell

############### VARIABLES ################################

$rootsiteUrl = "https:/webappurl"

################################################################

$rootSite = New-Object Microsoft.SharePoint.SPSite($rootsiteUrl)
$spWebApp = $rootSite.WebApplication
 
foreach($site in $spWebApp.Sites)
{
    foreach($siteAdmin in $site.RootWeb.SiteAdministrators)
    {
        Write-Host "$($siteAdmin.ParentWeb.Url) - $($siteAdmin.DisplayName)"
    }
    $site.Dispose()
}
$rootSite.Dispose()

Access to XMLHttpRequest at 'from origin has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. .net core angular

Issue: The angular application was getting error from API that the origin has been blocked by CORS policy. Solution: Make sure that the...