Create Word Automation Service Application using PowerShell in SharePoint 2016

The Word Automation Services Service Application provides developers a way to perform server-side conversion of documents supported by Microsoft Word (such as .doc, .docx, .rtf, etc.) into other formats such as PDF, XPS, RTF, DOCX, etc. In other words, Word Automation Services provides the “Save As” functionality of the Microsoft Word client for SharePoint.

How to Create Word Automation Service Application using SharePoint 2016 Central Administration?

To create a Word Automation Service Application from SharePoint 2016 Central Administration site, Go to:

  • Application Management >> Manage Service Applications.
  • On the Service Applications tab, click New >> and then click Word Automation Services Application.
  • In the Create New Word Automation Services Application dialog box, Enter the Name, Application Pool, Select “Add to Default Proxy List” and click on next.
    sharepoint 2013 configure word automation service application
  • Enter the Database Server name and name of the database for the word automation service application. Click Finish. 
    sharepoint 2016 create word automation service application powershell
  • Once created, The new instance of Word Automation Services appears in the list of service applications on the Service Applications tab.

PowerShell Script to Create Word Automation Service Application:

Use this PowerShell script to create a word automation service application in SharePoint 2013/SharePoint 2016.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Configuration Parameters
$ServiceAppName = "Word Automation Service Application"
$AppPoolName = "Service Application App Pool"
$AppPoolAccount = "Crescent\SP16-ServiceAppPool"
$DBName = "SP16_WordAutomation_ServiceApp"
$DBServer="SP16-SQL"

Try {
    #Set the Error Action
    $ErrorActionPreference = "Stop"
  
    #Check if Managed account is registered already
    Write-Host -ForegroundColor Yellow "Checking if the Managed Accounts already exists..."
    $AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolAccount -ErrorAction SilentlyContinue
    if($AppPoolAccount -eq $null)
    {
        Write-Host "Please Enter the password for the Service Account..."
        $AppPoolCredentials = Get-Credential $AppPoolAccount
        $AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCredentials
    }
  
    #Check if the application pool exists already
    Write-Host -ForegroundColor Yellow "Checking if the Application Pool already exists"
    $AppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -ErrorAction SilentlyContinue
    if ($AppPool -eq $null)
    {
        Write-Host -ForegroundColor Green "Creating Application Pool..."
        $AppPool = New-SPServiceApplicationPool -Name $AppPoolName -Account $AppPoolAccount
    }
  
    #Check if the Service application exists already
    Write-Host -ForegroundColor Yellow "Checking if Word Automation  Service Application exists already"
    $ServiceApplication = Get-SPServiceApplication -Name $ServiceAppName -ErrorAction SilentlyContinue
    if ($ServiceApplication -eq $null)
    {
        #There is no New-SPWordConversionServiceApplicationProxy, we can't therefore set it's name
        #The -default parameter adds the automatically created proxy to the default proxy group
        Write-Host "Creating $ServiceAppName Application & Proxy..."
        $ServiceApp = New-SPWordConversionServiceApplication -Name $ServiceAppName -ApplicationPool $AppPoolName -DatabaseName $DBName -DatabaseServer $DBServer -Default
    }
    
    #Start Service Instance(s)
    Write-Host -ForegroundColor Yellow "Starting the Word Automation Service Instance..."
    $ServiceInstance = Get-SPServiceInstance | where-object {$_.TypeName -eq "Word Automation Services"} | Start-SPServiceInstance
    
    Write-Host "Word Automation Service Application Created successfully!" -ForegroundColor Green
}
catch {
    Write-Host $_.Exception.Message -ForegroundColor Red
 }
 finally {
    #Reset the Error Action to Default
    $ErrorActionPreference = "Continue"
 }  

There is no cmdlet for creating service application proxy for word automation service (such as: New-SPWordConversionServiceApplicationProxy. So, the -Default switch in the above cmdlet adds the automatically created proxy to the default proxy group.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *