@sns ,
We can use following pnp powershell to get and set -LockState property of current site:
#Parameter
$SiteURL = "https://tenant.sharepoint.com/sites/Team1"
$UserName="******@tenant.onmicrosoft.com"
$Password= "xxxxxxx"
$SecurePassword = ConvertTo-SecureString -String $Password -AsPlainText -Force
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials $Cred
Set-PnPSite -LockState "ReadOnly"
Get-PnPTenantSite -Filter "LockState -eq 'ReadOnly'"
Unlock to unlock the site and make it available to users.
ReadOnly to prevent users from adding, updating, or deleting content. A message will appear on the site stating that the site is under maintenance and is read-only.
NoAccess to prevent users from accessing the site and its content. If you've provided a NoAccessRedirectUrl value for your organization (below), traffic will be redirected to the URL you specified. If you haven't set this URL, a 403 error will be displayed.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.