Skip to content

Assert ElevatedUser

dscbot edited this page Feb 13, 2024 · 2 revisions

Assert-ElevatedUser

SYNOPSIS

Assert that the user has elevated the PowerShell session.

SYNTAX

Assert-ElevatedUser [<CommonParameters>]

DESCRIPTION

Assert that the user has elevated the PowerShell session. The command will throw a statement-terminating error if the script is not run from an elevated session.

EXAMPLES

EXAMPLE 1

Assert-ElevatedUser

Throws an exception if the user has not elevated the PowerShell session.

EXAMPLE 2

`Assert-ElevatedUser -ErrorAction 'Stop'`

This example stops the entire script if it is not run from an elevated PowerShell session.

PARAMETERS

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

OUTPUTS

None.

NOTES

RELATED LINKS

Clone this wiki locally