Skip to content

Commit

Permalink
Merge pull request #736 from reshmee011/patch-1
Browse files Browse the repository at this point in the history
Update README.md with minor tweaks and additional settings
  • Loading branch information
pkbullock authored Sep 11, 2024
2 parents 49b7b7e + 2e0c571 commit 31a418d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions scripts/spo-get-site-sharing-settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Reviewing sharing settings is essential to prevent oversharing, which can lead t
# [PnP PowerShell](#tab/pnpps)

```powershell
Clear-Host
param (
[Parameter(Mandatory = $true)]
[string] $domain
Expand All @@ -39,7 +38,7 @@ $adminConnection = Get-PnPConnection
Write-Host "Getting site sharing settings..." -ForegroundColor Yellow
$sharingReport = Get-PnPTenantSite -Filter "Url -like '$TenantURL'" | Where-Object { $_.Template -ne 'RedirectSite#0' } | foreach-object {
try {
$sharingsetting = Get-PnPTenantSite -url $_.Url -Connection $adminConnection| select `
$sharingsetting = Get-PnPTenantSite -url $_.Url -DisableSharingForNonOwnersStatus -Connection $adminConnection| select `
Title, `
Url, `
ShowPeoplePickerSuggestionsForGuestUsers, `
Expand All @@ -52,8 +51,11 @@ $adminConnection = Get-PnPConnection
OverrideTenantAnonymousLinkExpirationPolicy, `
DefaultSharingLinkType, `
DefaultLinkPermission, `
DefaultShareLinkScope, `
DefaultShareLinkRole, `
DefaultLinkToExistingAccess, `
DisableCompanyWideSharingLinks, `
DisableSharingForNonOwnersStatus, `
AnonymousLinkExpirationInDays, `
ConditionalAccessPolicy, `
ReadOnlyForUnmanagedDevices, `
Expand All @@ -65,10 +67,10 @@ $adminConnection = Get-PnPConnection
RestrictedAccessControl, `
RestrictedAccessControlGroups, `
RestrictContentOrgWideSearch
# DefaultShareLinkScope and DefaultShareLinkRole will replace DefaultSharingLinkType and DefaultLinkPermission
#DisableSharingForNonOwners is not available in the get-pnptenantsite cmdlet, hence using the below workaround, alternative the properties are available from get-pnpweb cmdlet
$restUrl = $_.Url +'/_api/web?$select=MembersCanShare,TenantAdminMembersCanShare,RequestAccessEmail,UseAccessRequestDefault,AccessRequestSiteDescription'
connect-PnPOnline -Url https://reshmeeauckloo.sharepoint.com/sites/company311 -interactive -WarningAction SilentlyContinue
connect-PnPOnline -Url $_.Url -interactive -WarningAction SilentlyContinue
$siteconnection = Get-PnPConnection
$response = invoke-pnpsprestmethod -Url $restUrl -Method Get -Connection $siteconnection
Expand All @@ -85,6 +87,8 @@ $adminConnection = Get-PnPConnection
OverrideTenantExternalUserExpirationPolicy = $sharingsetting.OverrideTenantExternalUserExpirationPolicy
DefaultSharingLinkType = $sharingsetting.DefaultSharingLinkType
DefaultLinkPermission = $sharingsetting.DefaultLinkPermission
DefaultShareLinkScope = $sharingsetting.DefaultShareLinkScope
DefaultShareLinkRole = $sharingsetting.DefaultShareLinkRole
DefaultLinkToExistingAccess = $sharingsetting.DefaultLinkToExistingAccess
DisableCompanyWideSharingLinks = $sharingsetting.DisableCompanyWideSharingLinks
AnonymousLinkExpirationInDays = $sharingsetting.AnonymousLinkExpirationInDays
Expand All @@ -97,6 +101,7 @@ $adminConnection = Get-PnPConnection
RequestFilesLinkEnabled = $sharingsetting.RequestFilesLinkEnabled
RequestFilesLinkExpirationInDays = $sharingsetting.RequestFilesLinkExpirationInDays
RestrictContentOrgWideSearch = $sharingsetting.RestrictContentOrgWideSearch
DisableSharingForNonOwners = $sharingsetting.DisableSharingForNonOwnersStatus
##add the properties from the $response object
MembersCanShare = $response.MembersCanShare
TenantAdminMembersCanShare = $response.TenantAdminMembersCanShare
Expand All @@ -110,7 +115,7 @@ $adminConnection = Get-PnPConnection
}
}
$sharingReport |select * |Export-Csv $outputPath -NoTypeInformation -Append
Write-Host "Exported successfully!..." -ForegroundColor Green
Write-Host "Exported successfully!..." -ForegroundColor Green
```

[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)]
Expand All @@ -129,4 +134,4 @@ Sample first appeared on [Get SharePoint site sharing Settings with PowerShell](


[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)]
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/spo-get-site-sharing-settings" aria-hidden="true" />
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/spo-get-site-sharing-settings" aria-hidden="true" />
2 changes: 1 addition & 1 deletion scripts/spo-get-site-sharing-settings/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"Managing permissions in SharePoint is a critical aspect of maintaining data security and compliance within organisations. However, as SharePoint environments grow in complexity, manually auditing and managing permissions becomes increasingly challenging.Copilot for Microsoft m365 can access data from all the tenant, whether it’s Outlook emails, Teams chats and meetings, SharePoint and OneDrive. SharePoint is where all most documents, videos, and more are stored. Hence permission audit across sensitive sites to ensure 'Least privilege' is a must to avoid data leak while using Copilot for Microsoft m365 which makes it easier to discover content through prompts."
],
"creationDateTime": "2024-08-28",
"updateDateTime": "2024-08-28",
"updateDateTime": "2024-09-05",
"products": [
"SharePoint",
"Sharing settings",
Expand Down

0 comments on commit 31a418d

Please sign in to comment.