Deactivate Sandbox Solution with PowerShell in Office 365


In recent days Microsoft have released a Visual Studio solution which allows you to control SharePoint Online sandbox solutions.

The solutions builds a DLL file which can be imported as a PowerShell module and then you can use it to Upload, Activate, Deactivate and Delete solutions from a SharePoint Online site collection.

The provided documentation is great however during my own testing I found that solutions were not getting deactivated in my SharePoint Online 2010 site collections.

You will most likely find your 2010 site collection is actually in SharePoint 2013 version (15.0+) however if you use the -environment “MSO_2010” presents an error.  If you change this to -environment “MSO_2013” you will find it works even though you site collection appears to be in 2010.

Click here to download the solution from the Microsoft code website.  You will have to Build the solution to get the DLL as the one from the download does not work.  Alternatively you can download it from here.

Happy PowerShell’ing

Import Module

Import-Module “c:Contoso.Solution.Cmdlets.dll”

Upload Solution

upload-solution -username “” -password “XXXX” -siteurl “” -solutionfilepath “C:\Example.wsp” -environment MSO_2013

Activate Solution

activate-solution -username “” -password “xxxx” -siteurl “” -solutionid “5BC8D9A8-AE5A-4CF8-8D25-03B239818193” -environment MSO_2013

Deactivate Solution

deactivate-solution -username “” -password “xxxx” -siteurl “” -solutionid “5BC8D9A8-AE5A-4CF8-8D25-03B239818193” -environment MSO_2013

Delete Solution

delete-solution -username “” -password “xxxx” -siteurl “” -solutionid “5BC8D9A8-AE5A-4CF8-8D25-03B239818193” -environment MSO_2013


5 thoughts on “Deactivate Sandbox Solution with PowerShell in Office 365

  1. David

    Any idea why I’d receive the following?

    Exception calling “UploadSolution” with “3” argument(s): “The remote server returned an error: (403) Forbidden.”


    • A Pearce

      Is this for you root site collection? – can you get to Site Settings and Solutions in the browser with the same user?

  2. Satish Singh


    I am not able to active & deactiovate the WSP file using above powershell command.
    There is any issue or some more settings are required .Please provide your inputs.

  3. priyanka

    Hello ,
    I just want to know that in this import command what is “c:Contoso.Solution.Cmdlets.dll” as i also need to deactivate my solution from office 365 and i am not getting it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.