dbatools is a free PowerShell module with over 300 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


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).




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’.


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


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