I tried using the following script to disable one of my sub-sites:

Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential [email protected]

I get the following error:

The site is not properly formed.

It seems that this script only works at site collection level. Do we have any script which would work at sub site level as well? Or any other suggestion how I could disable this site.

  • 1
    could you please add ur complete code?
    – Waqas Sarwar MVP
    Commented Feb 21, 2018 at 15:08

2 Answers 2


There is no functionality available at subsite site level, locking available only at site collection level.

What you can do as a workaround,

  • Go to to Sub-site permission setting from Site settings
  • Stop the inheritance
  • Remove all users /groups or change their permission level. If you want to restrict for short time then make sure you copy the permission somewhere else before.

in addition to the above, you might like to also confirm theres no sites below the subsite that you dont want locked. If there is, break inheritence first.

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.