Add User To SharePoint Database Admin Using PowerShell Script

This course will help you learn the basics or refresh your knowledge and then provide a deeper understanding of advanced features of SharePoint 2013 from beginners to advanced users.
  • SharePoint 2013 is a collaboration environment that organizations of all sizes can use to increase the efficiency of business processes.
  • PowerShell is essentially the same, but with a lot more power. You can type your commands there and see the results just like before.
However, the benefit is that you can add your own "Shells" or set commands to enable the person using it to do more. If you want to learn PowerShell from the start, I recommend you check out this interesting guide that may help you get started.

https://www.darkoperator.com/powershellbasics/


Steps

Use the Add-SPShellAdmin cmdlet to add a user to the SharePoint_Shell_Access role.

Syntax

Add-SPShellAdmin [-UserName] <String> [-AssignmentCollection <SPAssignmentCollection>] [-Confirm [<SwitchParameter>]] [-database <SPDatabasePipeBind>] [-WhatIf [<SwitchParameter>]]
  1. Specifies the GUID of the database or the Database object that includes the SharePoint_Shell_Access role to which you want to add the user.
  2. The Database parameter is not specified, the configuration database is used by default.
  3. The farm configuration database is always included- if you specify another database.
Example

This will add a new user to the SharePoint_Shell_Access role in the farm configuration database.

Add-SPShellAdmin -UserName SPDEV\gowtham

This will add a new user to the SharePoint_Shell_Access role in both, the specified content database and the configuration database, by passing a database GUID to the cmdlet.

Add-SPShellAdmin -UserName SPDEV\gowtham -database 4hty1d844-3d45-4501-8dd1-98f960359fa6

Conclusion

Was my blog helpful? If yes, please let me know and if not, please explain what was confusing or missing. I’ll use your feedback to double-check the facts, add info and update this blog.