I was deploying a SharePoint installation without search. The installation failed during the Search Service Application creation with the following error:
Exception : System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to
parameter 'String' because it is null.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
TargetObject :
CategoryInfo : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException
FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSecureStr
ingCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at CreateEnterpriseSearchServiceApp,
D:\Install\ProjectServer\AutoSPInstaller\AutoSPInstallerFunctions.ps1: line 3967
at Setup-Services, D:\Install\ProjectServer\AutoSPInstaller\AutoSPInstallerMain.ps1: line 209
at <ScriptBlock>, D:\Install\ProjectServer\AutoSPInstaller\AutoSPInstallerMain.ps1: line 364
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :
The error was found to be related to the following code:
$searchServiceAccount = Get-SPManagedAccountXML $xmlinput -CommonName "SearchService"
$secSearchServicePassword = ConvertTo-SecureString -String $searchServiceAccount.Password -AsPlainText -Force
I added a managed account with CommonName of SearchService and the script worked as expected, however this should not be required if provision is set to false:
<EnterpriseSearchService Provision="false" ContactEmail="" ConnectionTimeout="60" AcknowledgementTimeout="60" ProxyType="Default" IgnoreSSLWarnings="false" InternetIdentity="Mozilla/4.0 (compatible; MSIE 4.01; Windows NT; MS Search 6.0 Robot)" CustomIndexLocation="" PerformanceLevel="PartlyReduced" ShareName="SearchIndex">
Comments: ** Comment from web user: brianlala **
Exception : System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to
parameter 'String' because it is null.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
TargetObject :
CategoryInfo : InvalidData: (:) [ConvertTo-SecureString], ParameterBindingValidationException
FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSecureStr
ingCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at CreateEnterpriseSearchServiceApp,
D:\Install\ProjectServer\AutoSPInstaller\AutoSPInstallerFunctions.ps1: line 3967
at Setup-Services, D:\Install\ProjectServer\AutoSPInstaller\AutoSPInstallerMain.ps1: line 209
at <ScriptBlock>, D:\Install\ProjectServer\AutoSPInstaller\AutoSPInstallerMain.ps1: line 364
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :
The error was found to be related to the following code:
$searchServiceAccount = Get-SPManagedAccountXML $xmlinput -CommonName "SearchService"
$secSearchServicePassword = ConvertTo-SecureString -String $searchServiceAccount.Password -AsPlainText -Force
I added a managed account with CommonName of SearchService and the script worked as expected, however this should not be required if provision is set to false:
<EnterpriseSearchService Provision="false" ContactEmail="" ConnectionTimeout="60" AcknowledgementTimeout="60" ProxyType="Default" IgnoreSSLWarnings="false" InternetIdentity="Mozilla/4.0 (compatible; MSIE 4.01; Windows NT; MS Search 6.0 Robot)" CustomIndexLocation="" PerformanceLevel="PartlyReduced" ShareName="SearchIndex">
Comments: ** Comment from web user: brianlala **
The fix will be something similar to this... replace the line:
```
$secSearchServicePassword = ConvertTo-SecureString -String $searchServiceAccount.Password -AsPlainText -Force
```
with:
```
# Check if the Search Service account username has been specified before we try to convert its password to a secure string
if (!([string]::IsNullOrEmpty($searchServiceAccount.Username)))
{
$secSearchServicePassword = ConvertTo-SecureString -String $searchServiceAccount.Password -AsPlainText -Force
}
else
{
Write-Host -ForegroundColor White " - Managed account credentials for Search Service have not been specified."
}
```
This will be included in the next release/changeset.
Brian