Change SQL Server Database Initial Size and Auto Growth Settings using PowerShell

Requirement: After a new farm deployment, I had to raise the size and growth of all SharePoint content databases. There were 20+ databases in the initial setup. As per SQL Server best practices for SharePoint, we must set the SharePoint content databases’ initial size and growth properties for better performance, which can…

Read more

Fix for “Cannot Connect to Database Master at SQL Server at Server Name. The Database might not exist, or the current user does not have permission to connect to it” SharePoint Error!

Problem:When trying to create a new SharePoint farm using PowerShell, the SharePoint 2016 management Shell gave an error message:New-SPConfigurationDatabase : Cannot connect to database master at SQL server at <SQL-Server-Alias>. The database might not exist, or the current user does not have permission to connect to it. I also tried using SharePoint…

Read more

Backup-Restore All SharePoint Databases in SQL Server using PowerShell

Requirement: We planned to move our SharePoint’s SQL database to a different server. So, we had to backup and restore all SharePoint databases from one SQL Server 2012 instance to another. How to Backup and Restore All SharePoint Databases from SQL Server using PowerShell? Here are the steps at a high level…

Read more

Export SharePoint List Data to SQL Server Table using PowerShell

Requirement: Export SharePoint list data to SQL Server table. For an in-house built business intelligence tool, We had a requirement to export SharePoint list data into an SQL Server table. As directly querying SharePoint content databases is not supported by Microsoft, it could also cause performance issues to your SharePoint farm –…

Read more

Import Data from SQL Server Table to SharePoint List using PowerShell

Requirement: We have an External CRM application from which data is to be extracted and inserted into a SharePoint List! PowerShell to Read Data from SQL Server and Insert into SharePoint: We created a new list “Projects” by mapping relevant columns as per the SQL Server table, and then here is my…

Read more

How to Set SharePoint Content Database to Read Only Mode using PowerShell?

Requirement: Set content database to read only in SharePoint Server using PowerShell. Solution:  We may have to set SharePoint databases to read-only mode in scenarios such as upgrades, disaster recovery / highly available maintenance, patching, etc. Setting SharePoint content database in read-only mode from SQL Server Management Studio is explained in another…

Read more

How to Move SharePoint Content Databases to Another Drive?

Requirement: Move SharePoint content database from one drive to another in SQL Server! By default, SharePoint creates its databases in the default SQL Server location: “C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA” folder (SQL Server 2016). We don’t have any option from the SharePoint side to specify where the data and log files for the…

Read more

How to Move All SharePoint Databases to a New SQL Server?

Requirement: Move SharePoint databases to a new SQL Server! You’ll have to move SharePoint databases, including all content databases, configuration databases, and service application databases to another SQL Server at least in a couple of circumstances: Upgrading SQL Server to a new version. E.g. Upgrading SQL  Server 2012 to SQL Server 2016. …

Read more

How to Rename SharePoint 2013 Content Databases with PowerShell?

Requirement: To follow standard naming conventions, We got to rename SharePoint content databases in our SharePoint 2013 environment. Solution: You can rename a SharePoint content database in these three steps as explained in my other post: How to Rename SharePoint 2013/2010 Central Admin Database and Remove GUID? Detach SharePoint content database from SharePoint…

Read more