< Back

Assert-AdministratorRole

Fri Jan 10, 2020 7:25 pm

NAME Assert-AdministratorRole



SYNOPSIS

Asserts that the current user is an administrator. Throws an error if not.





SYNTAX

Assert-AdministratorRole [[-errorMessage] <String>] [<CommonParameters>]





DESCRIPTION

Checks whether the current user is in the built-in Administrator role, and throws an error message if not.





PARAMETERS

-errorMessage <String>

The message to throw when the user is not an administrator



Required? false

Position? 1

Default value You do not have Administrator rights to run this script!

Please re-run this script as an Administrator!

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS





RELATED LINKS