Need a PS script to a add service account to log on as a service

Good morning!
Looking for some help need to add to add a service account to log on as a service from a list of servers. No idea how to accomplish this. Any help would be greatly appreciated

Thank you
Norm

You’re looking to assign the user ‘right’ called ‘SeServiceLogonRight’

You can backup the local security policy to file using something like

Start-Process secedit -ArgumentList "/export /areas USER_RIGHTS /cfg $FileName" -Wait -PassThru

Get the user SID using something like

$Sid = ((Get-LocalUser $userName -EA 1).SID).Value

Modify the Policy (text) file as needed - granting the user(s) as defined by their SID(s) the desired rights
and finally update the local security policy using something like

Start-Process secedit -ArgumentList "/configure /db $env:windir\security\database\secedit.sdb /cfg $FileName /areas USER_RIGHTS /log $($FileName.Replace('.inf','.log'))" -Wait -PassThru

Can you put it all together?