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


Gets the users with local privileges ‘Lock Pages in Memory’, ‘Instant File Initialization’, ‘Logon as Batch’ on one or more computers. Requires Local Admin rights on destination computer(s).



To get the local privileges on computer sqlserver2014a.

Get-DbaPrivilege -ComputerName sqlserver2014a

To get the local privileges on computers sql1, sql2 and sql3.

‘sql1′,’sql2′,’sql3’ | Get-DbaPrivilege

To get the local privileges on computers sql1 and sql2, and shows them in a grid view.

Get-DbaPrivilege -ComputerName sql1,sql2 | Out-Gridview


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


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

Source Code

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

Related commands