I’ve been playing a lot with PowerShell and SharePoint 2013 lately, and by a lot, I mean A LOT! One of the new additions with SharePoint 2013, is the set of new cmdlets that allow Sharepoint administrators to manage how apps are deployed in their environment. the new App model in Sharepoint 2013 is great, but it can easily create chaos if apps are not properly managed. One of the big problem I foresee for any organization that gets in the business of heavy customization using apps is the fact that there are no ways for them to easily identify what sites have a specific app installed on, and to determine what version of the ap is installed on them. Remember that with SharePoint 2013, you can have various versions of the same apps running in different sites.
For all of you out there that are desperate to find a solution to the scenario describe above, fear not! I have written a nice litle PowerShell script that will allow you to quickly identify on what site an app is installed, and what version of it is installed.
Add-PsSnapin Microsoft.SharePoint.PowerShell $appTitle = Read-Host "What is your App's title?" $rootUrl = Read-Host "What is your Web Application's Root Url?" $webApp = Get-SPWebApplication $rootUrl foreach($site in $webApp.Sites) { foreach($web in $site.AllWebs) { $appInstance = Get-SPAppInstance -Web $web.Url | Where{$_.Title -eq $appTitle} if($appInstance -ne $null) { Write-Host $web.Url -BackgroundColor Green Write-Host $appInstance.App.VersionString -BackgroundColor Cyan } } }