Skip to content

Add-LocalAdmin

SYNOPSIS

SYNTAX

Add-LocalAdmin [-user] <Object> [<CommonParameters>]

DESCRIPTION

This function adds a local admin to the computer or server it is run from.

EXAMPLES

EXAMPLE 1

Adds specified domain user to the local administrators group

Add-LocalAdmin -user domain\user

PARAMETERS

-user

The user that is to be added as a local admin

Type: System.Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
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

OUTPUTS

NOTES

Azure AD Joined machines will require the user to first login to a computer with their domain account before adding their domain account as a local admin. The user logging in registers their SID so that the command is successful.

Back to top