dbatools is a free PowerShell module with over 200 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Set-DbaPrivilege

Adds the SQL Service account to local privileges ‘Lock Pages in Memory’, ‘Instant File Initialization’, ‘Logon as Batch’ on one or more computers.
Requires Local Admin rights on the destination computer(s).

Screenshots

Get-DbaRoleMember

Examples

Set-DbaPrivilege -ComputerName sqlserver2014a -Type LPIM,IFI

Adds the SQL Service account(s) on computer sqlserver2014a to the local privileges ‘SeManageVolumePrivilege’ and ‘SeLockMemoryPrivilege’.

‘sql1′,’sql2′,’sql3’ | Set-DbaPrivilege -Type IFI

Adds the SQL Service account(s) on computers sql1, sql2 and sql3 to the local privilege ‘SeManageVolumePrivilege’.

Author

This command was created by Klaas Vandenberghe. You can find Klaas on Twitter and his blog.

Get-Help

From PowerShell, execute Get-Help Set-DbaPrivilege -Detailed for more information on this function.

Source Code

Want to see the source code? View Set-DbaPrivilege.ps1 on GitHub
 

Related commands