Assert-AdminPrivileges

Throws an exception if the user doesn't have administrator privileges.

Syntax

Assert-AdminPrivileges [<CommonParameters>]

Description

Many scripts and functions require the user to be running as an administrator. This function checks if the user is running as an administrator or with administrator privileges and throws an exception if the user doesn't.

Related Commands

EXAMPLE 1

Assert-AdminPrivileges

Throws an exception if the user doesn't have administrator privileges.