Is this early stage dev for supporting 2016, or has it been proving to be successful for anyone?
Please comment with your success if you have used it in a multi-tier farm.
Thanks.
So figured out that the module was not in the C:\Program Files\Powershell folder..which is why it wouldn't work. Copied it over from the system32 location to that one and it worked.
Hmm it shouldn't need to be in Program Files - just checked a local successful SharePoint installation and it was in C:\windows\system32\WindowsPowerShell\v1.0\Modules. Maybe there's something up with your PowerShell profile or your PATH environment variables etc. ?
Brian
I am also having this same issue on Windows 2012 R2. Guidance would be appreciated. Thank you.
OK, I believe I found the issue: there are actually two WcfDataServices prerequisites, but the 5.6 version is not downloaded if you use something like the prerequisiteinstaller tool. I found this article which will give you the 5.6 download location with instructions to rename it to WcfDataServices56.exe, which is the missing file causing this issue: https://blogs.technet.microsoft.com/cjrawson/2014/04/06/offline-installation-no-internet-connection-of-sharepoint-2013-sp1-prerequisites-on-windows-server-2012-r2/
replace the content section of the function CreateUPSAsAdmin with this one:
$content = @"
Write-Host "Creating $userProfileServiceName as $farmAcct..."
Add-PsSnapin Microsoft.SharePoint.PowerShell
`$newProfileServiceApp = New-SPProfileServiceApplication -Name `"$userProfileServiceName`" -ApplicationPool `"$($applicationPool.Name)`" -ProfileDBServer `"$profileDBServer`" -ProfileDBName $profileDB -ProfileSyncDBServer $syncDBServer -ProfileSyncDBName $syncDB -SocialDBServer $socialDBServer -SocialDBName $socialDB -MySiteHostLocation $mySiteHostLocation $mySiteManagedPathSwitch
If (-not `$?) {Write-Error " - Failed to create $userProfileServiceName"; Write-Host 'Press any key to exit...'; `$null = `$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')}
`. "$env:dp0\AutoSPInstallerFunctionsCustom.ps1"
Write-Host " - Grant the current install account rights to the newly-created Profile DB - needed since it's going to be running PowerShell commands against it"
Add-UserToDBOwnerRole $env:USERDOMAIN\$env:USERNAME $dbServer $profileDB
Write-Host ' - Grant the current install account rights to the newly-created Social DB as well'
Add-UserToDBOwnerRole $env:USERDOMAIN\$env:USERNAME $dbServer $socialDB
Write-Host ' - Grant the current install account rights to the newly-created Sync DB as well'
Add-UserToDBOwnerRole $env:USERDOMAIN\$env:USERNAME $dbServer $syncDB
"@
Add this function to the customfunctions script file:
Function Add-UserToDBOwnerRole
{
param
(
$Login,
$SQLInstance,
$DBName
)
$objSQLConnection = New-Object System.Data.SqlClient.SqlConnection
$objSQLCommand = New-Object System.Data.SqlClient.SqlCommand
Try
{
#$db = Get-SPDatabase $DBName
#$SQLInstance = $DBName.ServiceInstance.DisplayName
$objSQLConnection.ConnectionString = "Data Source=$SQLInstance;Integrated Security=SSPI;Initial Catalog=$DBName"
Write-ToLogFile -ForegroundColor White " - Granting the setup account $Login Db_Owner to the database $DBName"
$objSQLConnection.Open() | Out-Null
$strCmd = "EXEC sp_addrolemember @rolename = N'db_owner', @membername = N'$Login'"
$objSQLCommand.CommandText = $strCmd
$objSQLCommand.Connection = $objSQLConnection
$objSQLDataReader = $objSQLCommand.ExecuteNonQuery() | out-null
$objSQLConnection.Close()
}
catch
{
write-host $_
}
}
add error catching as you like
replace the content section of the function CreateUPSAsAdmin with this one:
```
$content = @"
Write-Host "Creating $userProfileServiceName as $farmAcct..."
Add-PsSnapin Microsoft.SharePoint.PowerShell
`$newProfileServiceApp = New-SPProfileServiceApplication -Name `"$userProfileServiceName`" -ApplicationPool `"$($applicationPool.Name)`" -ProfileDBServer `"$profileDBServer`" -ProfileDBName $profileDB -ProfileSyncDBServer $syncDBServer -ProfileSyncDBName $syncDB -SocialDBServer $socialDBServer -SocialDBName $socialDB -MySiteHostLocation $mySiteHostLocation $mySiteManagedPathSwitch
If (-not `$?) {Write-Error " - Failed to create $userProfileServiceName"; Write-Host 'Press any key to exit...'; `$null = `$host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')}
`. "$env:dp0\AutoSPInstallerFunctionsCustom.ps1"
Write-Host " - Grant the current install account rights to the newly-created Profile DB - needed since it's going to be running PowerShell commands against it"
Add-UserToDBOwnerRole $env:USERDOMAIN\$env:USERNAME $dbServer $profileDB
Write-Host ' - Grant the current install account rights to the newly-created Social DB as well'
Add-UserToDBOwnerRole $env:USERDOMAIN\$env:USERNAME $dbServer $socialDB
Write-Host ' - Grant the current install account rights to the newly-created Sync DB as well'
Add-UserToDBOwnerRole $env:USERDOMAIN\$env:USERNAME $dbServer $syncDB
"@
```
Add this function to the customfunctions script file:
```
Function Add-UserToDBOwnerRole
{
param
(
$Login,
$SQLInstance,
$DBName
)
$objSQLConnection = New-Object System.Data.SqlClient.SqlConnection
$objSQLCommand = New-Object System.Data.SqlClient.SqlCommand
Try
{
#$db = Get-SPDatabase $DBName
#$SQLInstance = $DBName.ServiceInstance.DisplayName
$objSQLConnection.ConnectionString = "Data Source=$SQLInstance;Integrated Security=SSPI;Initial Catalog=$DBName"
Write-ToLogFile -ForegroundColor White " - Granting the setup account $Login Db_Owner to the database $DBName"
$objSQLConnection.Open() | Out-Null
$strCmd = "EXEC sp_addrolemember @rolename = N'db_owner', @membername = N'$Login'"
$objSQLCommand.CommandText = $strCmd
$objSQLCommand.Connection = $objSQLConnection
$objSQLDataReader = $objSQLCommand.ExecuteNonQuery() | out-null
$objSQLConnection.Close()
}
catch
{
Write-Host $_
}
}
```
Manage errors to your liking
I am planning on updating the script if the amount of effort is reasonable. However definitely have a look at SharePointDSC if it meets your needs.
Brian
The reference in AutoSPInstallerFunctions.ps1/InstallPrerequisites (Line 731)
/WCFDataServices56:`"$env:SPbits\PrerequisiteInstallerFiles\WcfDataServices.exe`" `
is erroneous, and should read
/WCFDataServices56:`"$env:SPbits\PrerequisiteInstallerFiles\WcfDataServices56.exe`"
Thanks for the great tool! I am experiencing the exact same error for a SP2013 install.