Install and UnInstall SharePoint 2013 Apps using PowerShell

Here we will discuss how can we Install and Uninstall SharePoint 2013 Apps 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.

You may also read:
– Get SharePoint list created date using PowerShell


– Find larger files inside a web application in SharePoint using PowerShell

– PowerShell commands for SharePoint Online 2013

Installing an app has two steps:
1- First we need to Import the .app file to the site collection
2- 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 App in the 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 an App:
To uninstall an app, first we need to get the 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

Hope this will be helpful.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About 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 SharePointSky.com

View all posts by Bijay Kumar →