File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Tenant Settings/Get SharePoint Online tenant properties using Powershell and CSOM Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ function Get-SiteColl
2+ {
3+ param (
4+ [Parameter (Mandatory = $true , Position = 1 )]
5+ [string ]$Username ,
6+ [Parameter (Mandatory = $true , Position = 2 )]
7+ [string ]$Url ,
8+ [Parameter (Mandatory = $true , Position = 3 )]
9+ $password
10+ )
11+
12+
13+ $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url )
14+ $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username , $password )
15+ $ctx.Load ($ctx.Web )
16+ $ctx.ExecuteQuery ()
17+
18+ $spoTenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant($Ctx )
19+ $ctx.Load ($spoTenant )
20+ $ctx.ExecuteQuery ()
21+
22+ Write-Output $spoTenant
23+
24+ }
25+
26+
27+
28+
29+ # Paths to SDK
30+ Add-Type - Path " C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
31+ Add-Type - Path " C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"
32+ # Microsoft.Online.SharePoint.TenantAdministration.SiteProperties.AllowLimitedAccess
33+
34+
35+ # Enter the data
36+ $AdminPassword = Read-Host - Prompt " Enter password" - AsSecureString
37+ $username = " admin@TENANT.onmicrosoft.com"
38+ $Url = " https://TENANT-admin.sharepoint.com"
39+
40+
41+
42+
43+ Get-SiteColl - Username $username - Url $Url - password $AdminPassword
You can’t perform that action at this time.
0 commit comments