SharePoint 2016, Sharepoint 2013, Sharepoint 2010, Windows Server 2012, Sql Server 2012,2014,IIS, Active Directory,User Profile Service, Managed MetaData Service, Search Service, Topology, Web Application, IIS, Site collection, List, Library, PowerShell, office web app, Windows Authentication, NTLM, Kerberos, Saml, ADFS, Active Directory Import, MIM, SharePoint 2016 Set-SPContentDatabase not working using pipe line – SharePoint

SharePoint 2016 Set-SPContentDatabase not working using pipe line

If you try to change the settings of Content database via PowerShell and in your command, you use the Pipe line feature then it will throw the error.

I.e. we are trying to set the content database max site count to 5 and warning site count to 4. We use the following command:

Here is the error we get:

PS C:\Users\kfinst> Get-SPContentDatabase “WSS_content” | Set-SPContentDatabase

-MaxSiteCount 5 -WarningSiteCount 4

Set-SPContentDatabase : Could not connect to SPContentDatabase

Name=WSS_Content using integrated security: Cannot connect to database master

at SQL server at SPContentDatabase Name=WSS_Content. The database might not

exist, or the current user does not have permission to connect to it.

At line:1 char:39

+ Get-SPContentDatabase “WSS_content” | Set-SPContentDatabase -MaxSiteCount 5

-War …

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidData: (Microsoft.Share…ContentDatabase:

SPCmdletSetContentDatabase) [Set-SPContentDatabase], SPException

+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletSetConte

ntDatabase

PS C:\Users\kfinst>

No matter what method we use in the pipe it is not working like this

Or

But All the time we get the same error “Set-SPContentDatabase : Could not connect to SPContentDatabase

Name=WSS_Content using integrated security: Cannot connect to database master

at SQL server at SPContentDatabase Name=WSS_Content. The database might not

exist, or the current user does not have permission to connect to it.

Resolution

This is a bug in the command and reported to Microsoft. Microsoft currently working on this and in future updates will be fix. We will update this as soon as Microsoft released the fix.

Workaround

Currently, there are two workarounds for such sitution.

PowerShell

In order to change the settings of the content Database, don’t use the pipe line. Like this

To confirm the settings, please run the below command.

Central admin

Another method is to use the central admin and change the settings of content Database. Please follow the below steps to change the settings.

  • Log on Central Admin Site with farm admin account
  • Go to Application Management > Manage Content Database
  • On this page Select the Correct Web Application
  • Click on name of Content Database (it will be hyperlink)
  • On this page you can the change the required Settings (Status, Remove Content Database, Maximum Site Count, Warning Site Count, preferred Timer Job Server)

Applies to

This applies only to SharePoint Server 2016 (January 2017 Updates)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *