20 lines
487 B
PowerShell
20 lines
487 B
PowerShell
|
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 $_)}
|
||
|
}
|
||
|
|