Hi @Harish Patil ,
Please use ClientContext.Site property to check if site is read-only, please refer the following script:
#Variables for Processing
$SiteUrl = "https://TenantName.sharepoint.com/sites/SiteName/"
$UserName="user@TenantName.onmicrosoft.com"
$Password ="*******"
#Setup Credentials to connect
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
#Set up the context
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$Context.Credentials = $credentials
$Context.Load($Context.Site)
$Context.ExecuteQuery()
Write-Host "Checking Site ReadOnly" - $Context.Site.ReadOnly
Reference:
Thanks
Best Regards
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.