Share via


SharePoint 2013: Get all Access app instances with DB Name

 

SharePoint 2013 Access Services are not new to anyone. However, once we enable the Access Services, there is no way to govern the Service.

At the least, I wanted to see a report of all the Access app instances in a Web Application and what database is associated with the app.

I tried to find a script over the internet, but couldn’t find none ( May be it was there buried deep down). So thought of writing my own and sharing it on my blog.

 

The Script goes as :

 

    1: Add-PSSnapin Microsoft.SharePoint.PowerShell -ea SilentlyContinue;
    2: 
    3: $AccessAppPrincipal = "75dc9906-f841-484a-b392-1ed899b92e4b";
    4: $AccessAppPrincipalWildCard = "*" + $AccessAppPrincipal
    5: $webApplication = "https://<WEB APPLICATION URL>";
    6: 
    7: Start-SPAssignment -Global;
    8: $instance = New-Object System.Collections.ArrayList;
    9: 
   10: 
   11: Get-SPSite -WebApplication $webApplication -Limit All | Get-SPWeb -Limit All | ForEach-Object {$apps = Get-SPAppInstance -Web $_.Url | Where-Object {$_.AppPrincipalId -like $AccessAppPrincipalWildCard}| ForEach-Object {$instance.Add($_);} }
   12:  
   13:  
   14: Stop-SPAssignment -Global;
   15: Start-SPAssignment -Global;
   16:  
   17: foreach($app in $instance)
   18: {
   19:     $web = Get-SPWeb $app.AppWebFullUrl.ToString();
   20:     $app;
   21:     "DB Name: " + $web.AppDatabaseName;
   22:     $web.Dispose();
   23: }
   24:  
   25: Stop-SPAssignment -Global;