Office Web Apps error in site collections

I have successfully enabled the Office Web Application feature in my main site collection, so I can view word, excel, power point and one note documents in browser. But I was getting an error when I try to use the same functionality on a new site collection, such as

https://SharePointSiteName/sites/sitecollectionName

The solution is to make sure that Office Web Apps feature is activated in all (your ) site collection. To do this,

Set Windows PowerShell script execution policy

1. Click Start, point to All Programs, point to Windows PowerShell, right-click Windows PowerShell, and then click Run as administrator.

2. In the Windows PowerShell console, at the command prompt, type set-executionpolicy unrestricted, and then press ENTER.

Activate the Office Web Apps feature on all site collections

Office Web Apps require that the Office Web Apps feature be activated on every site collection for which the Web apps will be available. Activate the Office Web Apps feature for all site collections by running the following script:

 

$webAppsFeatureId = $(Get-SPFeature -limit all | where {$_.displayname

-eq "OfficeWebApps"}).Id

Get-SPSite –limit ALL |foreach{

Enable-SPFeature $webAppsFeatureId –url $_.URL }