I am trying to open closed site using the following code

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue

$spWeb = Get-SPWeb $URL

$isClosed = [Microsoft.Office.RecordsManagement.InformationPolicy.ProjectPolicy]::IsProjectClosed($spWeb)

If ($isClosed)
    write-host  "site is closed :" , $spWeb.url


it raised the following exception : (Exception calling "OpenProject" with "1" argument(s): "Sorry, this site hasn't been shared with you.")

However when I do the same but close project instead of open it, it working fine. BTY I am site collection administrator

Please advice !

2 Answers 2


May be there is right issue for the user running PowerShell script, Check the Permissions and try again.

  • The user who run PowerShell is site collection admin so what right permission needed ? Oct 5, 2016 at 13:51
  • and if there is missing permission , why CloseProject() works fine with the same user ? Oct 5, 2016 at 14:01

My college proposed solution for me and it working well that use elevated privilegses :


        #write code here 

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.