Grant SQL Server account access to Lock Pages in Memory using PowerShell DSC.

Lock Pages in Memory is a setting that can be set on 64-bit operating systems that essentially tell Windows not to swap out SQL Server memory to disk.

I was implementing SQL server hardening via PowerShell DSC and one of the requirement was to have Lock Pages In Memory enabled for SQL Service account. There was a powershell script created and available from blog post by keepingitgeek.

I converted this to a DSC module for my use. The code snippet is added below.