Local Policy Settings

I have a bunch of sql servers and don’t know whether the required local policies are in place to take advantage of the available memory. I first thought checking who could do what could be found via WMI but nothing surfaced. In my search I did find 2 new things: 1) the MS tool Scriptomatic 2.0 which will generate WMI scripts and 2) something called secedit. In the end I used ntrights.exe in a batch file as follows. As written it requires 2 parameters, the windows user requiring the permissions and server to apply the permissions.

@ECHO OFF
IF “%1” == “” GOTO MISSINGINPUT
IF “%2” == “” GOTO MISSINGINPUT
@ECHO ON
:: Act as part of the operating system
ntrights -u %1 -m \%2 +r SeTcbPrivilege 
:: Lock pages in memory            
ntrights -u %1 -m \%2 +r SeLockMemoryPrivilege
:: Log on as a batch job           
ntrights -u %1 -m \%2 +r SeBatchLogonRight
:: Logon as a service
ntrights -u %1 -m \%2 +r SeServiceLogonRight
:: Replace a process-level token   
ntrights -u %1 -m \%2 +r SeAssignPrimaryTokenPrivilege
pause
exit

:MISSINGINPUT
@ECHO OFF
ECHO You must specify the windows user to apply these permissions
ECHO You must specify the server on which to apply these permissions
pause
exit

This entry was posted in DBA. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *