function Grant-UserLogonAsServiceRights { <# .SYNOPSIS Grants a User the Logon as a Service Right #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$userName ) $logLead = (Get-LogLeadName); Grant-UserLocalSecurityPolicyRights $userName "SeServiceLogonRight" $secPolLogContent = Get-Content (Join-Path $env:windir "security\logs\scesrv.log") $secPolLogContent | ForEach-Object { Write-Verbose ("$logLead : {0}" -f $_)} }