I tried to create a new SharePoint Server 2010 farm by using PowerShell cmdlet “New-SPConfigurationDatabase” in one of the first steps.
I got this error:
New-SPConfigurationDatabase : The passphrase supplied does not meet the minimum complexity requirements. Please select another passphrase that meets all of the following criteria: is at least 8 characters; contains at least three of the following four character groups: English uppercase characters (A through Z); English lowercase characters (a through z); Numerals (0 through 9); Non-alphabetic characters (such as !, $, #, %). Type a passphrase which meets these requirements.
At C:UsersService.SP_InstallDesktopSetupScript.ps1:41 char:28
+ New-SPConfigurationDatabase <<<< -DatabaseName $spconfigdbname -DatabaseServer $dbserver -Passphrase $sppassphrase_sec -FarmCredentials $spfarmcredential
+ CategoryInfo : InvalidArgument: (System.Security.SecureString:SecureString) [New-SPConfigurationDatabase], SPException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSPConfigurationDatabase
This is my script:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$sppassphrase=“GOY$sV3SthlkyN%3YTdS&”
$sppassphrase_sec = (ConvertTo-SecureString $sppassphrase -AsPlainText -force)
$spfarmuser=“domainfarmaccount”
$spfarmuserpwd=“P@ssw0rd”
#Securing Settings
$spfarmcredential = new-object -typename System.Management.Automation.PSCredential -argumentlist $spfarmuser, (ConvertTo-SecureString $spfarmuserpwd -AsPlainText -force)
New-SPConfigurationDatabase –DatabaseName “configdb” -DatabaseServer “sqlserver” -Passphrase $sppassphrase_sec -FarmCredentials $spfarmcredential
After debugging I found the following:
When I write the value of variable “$sppassphrase” the the console (with cmdlet write-host) I get:
GOY%3YTdS&
instead of
GOY$sV3SthlkyN%3YTdS&
The problem is: The part “$sV3SthlkyN” will be interpreted as variable name!!!
You have to use escape sequences at least for the “$” character:
$sppassphrase=“GOY`$sV3SthlkyN%3YTdS&”
UPDATE!
Use ‘ instead of ” and you will not have a problem at all!
$sppassphrase=‘GOY$sV3SthlkyN%3YTdS&’
You’ll get what you’ve expected: The correct password string including “$”… (But the solution above also works!)