The cUserRightsAssignment module contains the cUserRight DSC resource that provides a mechanism to manage user rights: logon rights and privileges.
You can also download this module from the PowerShell Gallery.
The cUserRight DSC resource provides a mechanism to manage user rights: logon rights and privileges.
- Ensure: Indicates if the user right is assigned. Set this property to
Absent
to ensure that the user right is not assigned. Setting it toPresent
(the default value) ensures that the user right is assigned. - Constant: Indicates the constant name that is associated with a user right. For the list of available constants, see User Rights Assignment.
- Principal: Indicates the identity of the principal. Valid formats are:
- General improvements.
- General improvements.
- Initial release with the following DSC resources:
- cUserRight
This example shows how to use the cUserRight DSC resource to assign logon rights.
Configuration Sample_cUserRight
{
Import-DscResource -ModuleName cUserRightsAssignment
# Ensure the 'Log on as a service' logon right is assigned to the local 'Power Users' group.
cUserRight GrantServiceLogonRight
{
Ensure = 'Present'
Constant = 'SeServiceLogonRight'
Principal = 'BUILTIN\Power Users'
}
# Ensure the 'Log on as a batch job' logon right is not assigned to the local 'Power Users' group.
cUserRight RevokeBatchLogonRight
{
Ensure = 'Absent'
Constant = 'SeBatchLogonRight'
Principal = 'BUILTIN\Power Users'
}
}
$OutputPath = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath 'Sample_cUserRight'
Sample_cUserRight -OutputPath $OutputPath
Start-DscConfiguration -Path $OutputPath -Force -Verbose -Wait