Is there any SharePoint Online PowerShell script available to export the value of "DefaultLinkType" of all the sites in Tenant to a CSV?

I am not able to find one.

2 Answers 2


There is no ready-made PowerShell script for your requirement. But, I will help you to build this script on your own.

Get DefaultLinkType property of a SharePoint site:

If you want to get the DefaultLinkType property of a SharePoint site then you can use:

$site = Get-SPOSite -Identity https://spexplorer.sharepoint.com/sites/SPConnect -Detailed

Get all sites in tenant:

Connect-SPOService -Url https://xxx-admin.sharepoint.com
$sites = Get-SPOSite -Limit ALL

So you can use the for loop like below to get the site details:

Connect-SPOService -Url https://<tenant-name>-admin.sharepoint.com

$sites = Get-SPOSite -Limit ALL

foreach ($site in $sites) {
    $siteDetailed = Get-SPOSite $site.Url -Detailed 
  • Refer this link as a reference to export data to CSV. Mar 11, 2020 at 13:13
  • Have you tried this? is it working for you?? Mar 12, 2020 at 10:10
  • Hi @George, does this answers your question? If Yes, please upvote and accept it as an answer so that it will not be shown in unanswered questions list. Mar 23, 2020 at 9:14

Demo code for your reference:

Get-SPOSite | Select @{ L = "url"; E = { $_.url } }, @{ L = "DefaultLinkType"; E = { $_.DefaultSharingLinkType } } | Export-Csv -Path c:\export.csv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.