Skip to main content

Invoke-CPCChangeUserAccountType

SYNOPSIS​

Changes the local account type of the user on a Cloud PC

SYNTAX​

Name (Default)​

Invoke-CPCChangeUserAccountType -Name <String> -UserAccountType <String> [-ProgressAction <ActionPreference>]
[-WhatIf] [-Confirm] [<CommonParameters>]

Id​

Invoke-CPCChangeUserAccountType -CloudPCId <String> -UserAccountType <String>
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION​

The function will change the user account type on a specific Cloud PC between standard user and local administrator using the Microsoft Graph beta API. Use this to elevate a user to local admin for troubleshooting or to demote an administrator back to a standard user for compliance reasons.

You can identify the target Cloud PC by its managed device name (default) or by providing the Cloud PC object ID directly via -CloudPCId.

EXAMPLES​

EXAMPLE 1​

Invoke-CPCChangeUserAccountType -Name "CPC-User-XXXX" -UserAccountType administrator

EXAMPLE 2​

Invoke-CPCChangeUserAccountType -CloudPCId "4b5ad5e0-6a0b-4ffc-818d-36bb23cf4dbd" -UserAccountType standardUser

EXAMPLE 3​

Invoke-CPCChangeUserAccountType -Name "CPC-User-XXXX" -UserAccountType administrator -WhatIf

PARAMETERS​

-Name​

The managed device name of the Cloud PC. Use Get-CloudPC to find Cloud PC names. Mutually exclusive with -CloudPCId.

Type: String
Parameter Sets: Name
Aliases:

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

-CloudPCId​

The object ID (GUID) of the Cloud PC. Use Get-CloudPC to find Cloud PC IDs. Mutually exclusive with -Name.

Type: String
Parameter Sets: Id
Aliases:

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

-UserAccountType​

The account type to set for the user on the Cloud PC. Valid values: 'standardUser', 'administrator'.

Type: String
Parameter Sets: (All)
Aliases:

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

-WhatIf​

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

-Confirm​

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-ProgressAction​

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by Write-Progress.

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
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​

Requires CloudPC.ReadWrite.All permission (delegated or application). This action uses the Microsoft Graph beta endpoint. API reference: https://learn.microsoft.com/en-us/graph/api/cloudpc-changeuseraccounttype