Thursday, May 9, 2019

Get SharePoint Online all site collection details using power shell

   # If you find error related with  Connect-SPOService . You need to download and install the SharePoint Online Management Shell : DOWNLOAD

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$SPOModulePath = 'C:\Program Files\SharePoint Online Management Shell\'
$adminUPN = 'Admin.User@softPOC.com'
$orgName = 'SOFTPOC'

$userCredential = Get-Credential -UserName $adminUPN
$Env:PSModulePath = '{0};{1}' -f $Env:PSModulePath, $SPOModulePath
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
$uri = "https://$orgName-admin.sharepoint.com"
Connect-SPOService -Url $uri -Credential $userCredential
$sites = Get-SPOSite -Limit All
$sites | select url,owner

# Create a folder with name Temp in C:\ drive
$CSVpath = "C:\Temp\SharePoint-SiteCollection-Report-New.csv"
$sites | Export-CSV -Path $CSVpath -Append -NoTypeInformation

1 comment:

  1. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.
    Sharepoint helpdesk

    ReplyDelete

HTML

Script:

JS