Functions/Get-SharePointOnlineSettingObjects.ps1
<#
.SYNOPSIS This function returns objects representing the various settings which can be retrieved from SharePoint Online. .DESCRIPTION This function returns objects representing the various settings which can be retrieved from SharePoint Online. Each object contains a description of the setting, a script block which returns the value of the setting, and the name of the setting which is suitable for a variable name. #> function Get-SharePointOnlineSettingObjects { [CmdletBinding(PositionalBinding=$false)] [OutputType([PSCustomObject[]])] param () # Return the setting objects return @( [PSCustomObject]@{ Description = "external users" ScriptBlock = { Get-SPOExternalUser } VariableName = "ExternalUsers" }, [PSCustomObject]@{ Description = "sites" ScriptBlock = { Get-SPOSite } VariableName = "Sites" }, [PSCustomObject]@{ Description = "site data encryption policies" ScriptBlock = { foreach ($site in (Get-SPOSite)) { Get-SPOSiteDataEncryptionPolicy -Identity $site.Url } } VariableName = "SiteDataEncryptionPolicies" }, [PSCustomObject]@{ Description = "site groups" ScriptBlock = { foreach ($site in (Get-SPOSite)) { $siteGroups = Get-SPOSiteGroup -Site $site.Url foreach ($group in $siteGroups) { $group = $group | Select-Object -Property * $group | Add-Member -NotePropertyName "URL" -NotePropertyValue $site.Url -Force $group.Users = ($group.Users | ForEach-Object { "$($_)" }) -join "," $group.Roles = ($group.Roles | ForEach-Object { "$($_)" }) -join "," $group } } } VariableName = "SiteGroups" }, [PSCustomObject]@{ Description = "tenant settings" ScriptBlock = { Get-SPOTenant } VariableName = "TenantSettings" }, [PSCustomObject]@{ Description = "CDN enabled" ScriptBlock = { @( [PSCustomObject]@{ CDNType = "Public" Enabled = "$((Get-SPOTenantCdnEnabled -CdnType Public).Value)" }, [PSCustomObject]@{ CDNType = "Private" Enabled = "$((Get-SPOTenantCdnEnabled -CdnType Private).Value)" } ) } VariableName = "CdnEnabled" }, [PSCustomObject]@{ Description = "tenant sync client restrictions" ScriptBlock = { $restrictions = Get-SPOTenantSyncClientRestriction $restrictions = $restrictions | Select-Object -Property * $restrictions.AllowedDomainList = ($restrictions.AllowedDomainList | ForEach-Object { "$($_)" }) -join "," $restrictions.ExcludedFileExtensions = ($restrictions.ExcludedFileExtensions | ForEach-Object { "$($_)" }) -join "," $restrictions } VariableName = "TenantSyncClientRestrictions" }, [PSCustomObject]@{ Description = "users" ScriptBlock = { foreach ($site in (Get-SPOSite)) { $users = Get-SPOUser -Site $site.Url foreach ($user in $users) { $user = $user | Select-Object -Property * $user | Add-Member -NotePropertyName "URL" -NotePropertyValue $site.Url $user.Groups = ($user.Groups | ForEach-Object { "$($_)" }) -join "," $user } } } VariableName = "Users" }, [PSCustomObject]@{ Description = "web templates" ScriptBlock = { Get-SPOWebTemplate } VariableName = "WebTemplates" } ) } |