Skip to content

Invoke‑WindowsAccessControl

raandree edited this page Sep 6, 2026 · 1 revision

SYNOPSIS

Runs Windows access-control operations as an explicit local identity.

SYNTAX

Invoke-WindowsAccessControl [-Credential] <PSCredential> [-ScriptBlock] <ScriptBlock>
 [[-ArgumentList] <Object[]>] [<CommonParameters>]

DESCRIPTION

Logs on the supplied Windows identity for a local interactive session, executes the script block under that identity, and restores the caller identity before returning. The credential does not enable remote target syntax and its password is never written to module output or logs.

EXAMPLES

EXAMPLE 1

Invoke-WindowsAccessControl -Credential $credential -ScriptBlock {
    Get-NTFSAccessRule -LiteralPath 'C:\Data'
}

Reads the local path while impersonating the supplied Windows identity.

PARAMETERS

-ArgumentList

Supplies positional values passed to the impersonated script block. Use an empty array when the script block does not declare parameters.

Type: Object[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: @()
Accept pipeline input: False
Accept wildcard characters: False

-Credential

Supplies the Windows identity used only for this local impersonation scope. Domain-qualified, local, and user principal names are accepted.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ScriptBlock

Specifies one or more local WindowsAccessControl operations to execute while the supplied Windows identity is impersonated.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Object

NOTES

RELATED LINKS

Home

Commands

DSC resources

Clone this wiki locally