Install and UnInstall SharePoint 2013/2016 Apps/Add-ins using PowerShell

This PowerApps SharePoint tutorial explains, how to install apps or add-ins using PowerShell in SharePoint 2013/2016. We will also see how to uninstall SharePoint 2013 apps or add-ins using PowerShell.

If you are developing a SharePoint hosted app using Visual Studio then when you will publish the app, it will create a .app file. Before executing any PowerShell command make sure we have the .app file is ready.

Install SharePoint Apps or Add-ins using PowerShell

Follow the below steps to install apps in SharePoint 2013/2016 using PowerShell.

Installing an app has two steps:

  • First, we need to Import the .app file to the site collection.
  • Then install the app to any site or subsite

1- Import App to Site Collection:
This we can do by using the Import-SPAppPackage cmdlets.

Syntax:

$myapp = Import-SPAppPackage -Path < Path to app > -Site < URL > -Source < Source >

Here Path is the file path where your .app file presents
URL: URL of the Site Collection where you want to import.
Source: This can be Marketplace or CorporateCatalog, developer site, ObjectModel, etc.

Example:
$myapp = Import-SPAppPackage -Path "c:\MyfirstApp.app" -Site "http://SiteCollectionURL" –Source ObjectModel

This will import the .app file to the site collection.

2-Install the App in the SharePoint Site:

Now you can install the app to a site or subsite by using Install-SPApp cmdlets.

Install-SPApp -Web http://SiteCollectionURL/site -Identity $myapp

UnInstall SharePoint Apps using PowerShell

To uninstall an app, first, we need to get a particular app from the site.

$installedapp = Get-SPAppInstance -web http://SiteCollectionURL/site | Where-Object { $_.Title -eq "myapp" }

Then you can uninstall by using Uninstall-SPAppInstance cmdlets.

Uninstall-SPAppInstance -Identity $installedapp

You may like following SharePoint PowerShell tutorials:

Hope, this SharePoint tutorial explains, how to install and uninstall SharePoint apps using PowerShell.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com

>