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.
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
$site.DefaultSharingLinkType
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
$siteDetailed.DefaultSharingLinkType
}
Demo code for your reference:
Connect-SPOService
Get-SPOSite | Select @{ L = "url"; E = { $_.url } }, @{ L = "DefaultLinkType"; E = { $_.DefaultSharingLinkType } } | Export-Csv -Path c:\export.csv