Changing the Default Content Access Account programmatically is something I never really look at while configuring the Search Service Application. I always thought that it was easier to change it manually than including this in my configuration script.
A few days ago I came across TechNet’s “Set-SPEnterpriseSearchServiceApplication” page and I realized that changing the Default Content Access Account (I’ll call it DCAA :)) using Windows Powershell is very easy.
First of all let me say that you cannot configure this account while creating the service application, but you have to change it once the SA is provisioned. Set-SPEnterpriseSearchServiceApplication cmdlet include two parameters that let you change the DCAA that are not present in the New-SPEnterpriseSearchServiceApplication. The parameters are DefaultContentAccessAccountName and DefaultContentAccessAccountPassword.
This is how you can change the DCAA using Windows Powershell. Since DefaultContentAccessAccountPassword accepts a System.Security.SecureString object we need to set it before calling Set-SPEnterpriseSearchServiceApplication. I do it this way:
1 |
$dcaapwd = Read-Host -AsSecureString |
I don’t want to save the user account password in my configuration script, so I ask it to the user :) Then I select the Search Service Application.
1 |
$sa = Get-SPEnterpriseSearchServiceApplication "Enterprise Search" |
and at least I run the Set-SPEnterpriseSearchServiceApplication cmdlet.
1 |
Set-SPEnterpriseSearchServiceApplication -Identity $sa -DefaultContentAccessAccountName GTLAB\svc_spsearch -DefaultContentAccessAccountPassword $dcaapwd |
Et voilà! Quick and easy :)
– Riccardo