Note: This script will be very useful to test whether the WAS service is working properly in the environment. In addition, it will help to find out the source and destination libraries have proper permissions for the WAS to generate the PDF
clear
Remove-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.Powershell
$webAppUrl = "http://webappurl"
[void][System.Reflection.Assembly]::LoadWithPartialName( "Microsoft.Office.Word.Server" )
$jobSettings = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJobSettings
$jobSettings.OutputFormat = "PDF"
$job = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJob( "Word Automation Services", $jobSettings )
$job.UserToken = (Get-SPWeb $webAppUrl).CurrentUser.UserToken
#Provide the full document url with docx and pdf location
$job.AddFile( "http://webappurl/Shared%20Documents/test1.docx", "http://webappurl/Shared%20Documents/ConvertedDoc.pdf" )
$job.Start( )
write-host "Complete"