Sunday, July 16, 2017

Configure Sharepoint App using Powershell

Here is the power shell Script to Configure the App Management Service and Subscription Setting Service.


Create App Management Service


$account = Get-SPManagedAccount "<Service Account>"
# Gets the name of the Farm administrators account and sets it to the variable $account for later use.

$appPoolAppSvc = New-SPServiceApplicationPool -Name "Service App Pool Name"-Account $account
# Creates an application pool for the Application Management service application. 
# Uses the Farm administrators account as the security account for the application pool.
# Stores the application pool as a variable for later use.

$appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name "App Management Service" -DatabaseName "APP Management Servcie Database"
# Creates the Application Management service application, using the variable to associate it with the application pool that was created earlier.
# Stores the new service application as a variable for later use.

$proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc

$AppService = get-spserviceinstance -all |where {$_.TypeName -like "App Management Service*"}
if($AppService.Status -eq "Disabled")
{
get-spserviceinstance -all |where {$_.TypeName -like "App Management Service*"} | Start-SPServiceInstance
Write-Host $AppService.TypeName"Servcie is disable" -ForegroundColor Green
}
else
{
Write-Host $AppService.TypeName"Servcie Instance is already started" -ForegroundColor Green
}


Create Subscription Settings Service

$account = Get-SPManagedAccount "<Service Account>"
# Gets the name of the Farm administrators account and sets it to the variable $account for later use.

$appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
# Creates an application pool for the Subscription Settings service application. 
# Uses the Farm administrators account as the security account for the application pool.
# Stores the application pool as a variable for later use.

$appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SPSubscriptionSettingsService –DatabaseName SPSubscriptionSettingsServiceDB
# Creates the Subscription Settings service application, using the variable to associate it with the application pool that was created earlier.
# Stores the new service application as a variable for later use.

$proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
# Creates a proxy for the Subscription Settings service application.


$AppService = get-spserviceinstance -all |where {$_.TypeName -like "Microsoft SharePoint Foundation Subscription*"}
if($AppService.Status -eq "Disabled")
{
get-spserviceinstance -all |where {$_.TypeName -like "Microsoft SharePoint Foundation Subscription*"} | Start-SPServiceInstance
Write-Host $AppService.TypeName"Servcie is disable" -ForegroundColor Green
}
else
{
Write-Host $AppService.TypeName"Servcie Instance is already started" -ForegroundColor Green
}

No comments:

Post a Comment