Curated Examples
Stage a user-rights change
Use SecurityPolicy with WhatIf before changing a privilege assignment.
This pattern is useful when a security policy change needs a dry run before it is applied.
It comes from the source example at Examples/SetUserRights.ps1.
When to use this pattern
- You are preparing a controlled user-rights assignment update.
- You want to validate the intended identity list first.
- The change should be reviewable before execution.
Example
Import-Module SecurityPolicy
$identity = @(
'BUILTIN\Backup Operators'
'BUILTIN\Administrators'
)
Set-UserRightsAssignment -UserRightsAssignment SeBackupPrivilege -Identity $identity -WhatIf
What this demonstrates
- using an explicit identity list
- staging the update with
-WhatIf - targeting a single named privilege