Product Documentation

Remove-AcctADAccount

Nov 11, 2015

Removes AD computer accounts from an identity pool.

Syntax

Remove-AcctADAccount [-IdentityPoolName] <String> -ADAccountName <String[]> [-RemovalOption <ADIdentityRemoveAccountOption>] [-Force] [-LoggingId <Guid>] [-AdminAddress <String>] [<CommonParameters>]

Remove-AcctADAccount [-IdentityPoolName] <String> -ADAccountSid <String[]> [-RemovalOption <ADIdentityRemoveAccountOption>] [-Force] [-LoggingId <Guid>] [-AdminAddress <String>] [<CommonParameters>]

Remove-AcctADAccount -IdentityPoolUid <Guid> -ADAccountSid <String[]> [-RemovalOption <ADIdentityRemoveAccountOption>] [-Force] [-LoggingId <Guid>] [-AdminAddress <String>] [<CommonParameters>]

Remove-AcctADAccount -IdentityPoolUid <Guid> -ADAccountName <String[]> [-RemovalOption <ADIdentityRemoveAccountOption>] [-Force] [-LoggingId <Guid>] [-AdminAddress <String>] [<CommonParameters>]

Detailed Description

Provides the ability to remove AD accounts from an identity pool. This removes the AD account from the Citrix service management scope. This process provides the options for removing the account in AD (or disabling it) if required.

All aspects of this command that need to make modifications to the accounts in AD will use the account that the runspace is using. This means that if an account is to be removed from AD or disabled, the user performing the operation in PowerShell must have sufficient privileges in AD for this operation to complete successfully.

If the option to remove the account from AD or to disable it in AD is specified, the AD operation must succeed for the account to be removed from the Citrix AD Identity Service database. Use caution when using the Force parameter because this allows removal of accounts that are in the 'inUse' state, which may result in the machines becoming unusable.

Parameters

-IdentityPoolName<String>

The identity pool that the accounts are to be removed from.

Required? true
Default Value  
Accept Pipeline Input? false

-ADAccountName<String[]>

The AD account name to be removed. AD accounts are accepted in the following formats: Fully qualified DN e.g. CN=MyComputer,OU=Computers,DC=MyDomain,DC=Com; UPN format e.g MyComputer@MyDomain.Com; Domain qualified e.g MyDomain\MyComputer.

Required? true
Default Value  
Accept Pipeline Input? false

-ADAccountSid<String[]>

The Active Directory Account SID for the account to be removed.

Required? true
Default Value  
Accept Pipeline Input? true (ByPropertyName)

-IdentityPoolUid<Guid>

The unique identifier for the identity pool that the accounts are to be removed from.

Required? true
Default Value  
Accept Pipeline Input? true (ByPropertyName)

-RemovalOption<ADIdentityRemoveAccountOption>

Defines the behavior relating to the AD account.

None - Do not attempt to remove the account from AD Delete - Attempt to remove the account from AD Disable - Attempt to disable the account in AD

Required? false
Default Value None
Accept Pipeline Input? false

-Force<SwitchParameter>

Indicates if accounts that are marked as 'in-use' can be removed.

Required? false
Default Value  
Accept Pipeline Input? false

-LoggingId<Guid>

Specifies the identifier of the high-level operation this cmdlet call forms a part of. Citrix Studio and Director typically create high-level operations. PowerShell scripts can also wrap a series of cmdlet calls in a high-level operation by way of the Start-LogHighLevelOperation and Stop-LogHighLevelOperation cmdlets.

Required? false
Default Value  
Accept Pipeline Input? false

-AdminAddress<String>

Specifies the address of a XenDesktop controller that the PowerShell snap-in connects to. You can provide this as a host name or an IP address.

Required? false
Default Value LocalHost. Once a value is provided by any cmdlet, this value becomes the default.
Accept Pipeline Input? false

Return Values

Citrix.AdIdentity.Sdk.AccountOperationSummary

The remove-AcctADAccout command returns an object with the following parameters;

SuccessfulAccountsCount <int>

The number of accounts that were removed successfully.

FailedAccountsCount <int>

The number of accounts that were not removed.

FailedAccounts <Citrix.AdIdentity.Sdk.AccountError[]>

The list of accounts that failed to be removed. Each one has the following parameters:

ADAccountName <string>

ADAccountSid <String>

ErrorReason <AdIdentityStatus>

This can be one of the following

UnableToConvertDomain

IdentityNotLocatedInDomain

IdentityNotInIdentityPool

IdentityObjectInUse

IdentityObjectLocked

ADServiceDatabaseError

ADServiceDatabaseNotConfigured

ADServiceStatusInvalidDb

FailedToConnectToDomainController

FailedToDisableAccountInAD

FailedToDeleteAccountInAD

FailedToExecuteSearchInAD

FailedToAccessComputerAccountInAD

DiagnosticInformtion <Exception>

Any other error information

Notes

In the case of failure, the following errors can result.

Error Codes

-----------

IdentityPoolNotFound

The specified identity pool was not found.

IdentityPoolAlreadyLocked

The specified identity pool was locked by another operation.

PermissionDenied

The user does not have administrative rights to perform this operation.

ConfigurationLoggingError

The operation could not be performed because of a configuration logging error

DatabaseError

An error occurred in the service while attempting a database operation.

DatabaseNotConfigured

The operation could not be completed because the database for the service is not configured.

ServiceStatusInvalidDb

An error occurred in the service while attempting a database operation - communication with the database failed for

for various reasons.

CommunicationError

An error occurred while communicating with the service.

ExceptionThrown

An unexpected error occurred. To locate more details, see the Windows event logs on the controller being used or examine the XenDesktop logs.

Examples

-------------------------- EXAMPLE 1 --------------------------

C:\PS>Remove-AcctADAccount -IdentityPool MyPool -ADAccountName "Domain\account","domain\account2" 
 
 
    SuccessfulAccountsCount       FailedAccountsCount    FailedAccounts 
    -----------------------       -------------------    -------------- 
                          2                         0    {}

Removes two accounts (account and account2) from the identity pool called "MyPool", leaving the AD accounts untouched.

-------------------------- EXAMPLE 2 --------------------------

C:\PS>Remove-AcctADAccount -IdentityPool MyPool -RemovalOption Delete -ADAccountName "Domain\account","domain\account2" 
 
 
    SuccessfulAccountsCount       FailedAccountsCount    FailedAccounts 
    -----------------------       -------------------    -------------- 
                          2                         0    {}

Removes two accounts (account and account2) from the identity pool called "MyPool" (and from Active Directory).

-------------------------- EXAMPLE 3 --------------------------

C:\PS>Remove-AcctADAccount -IdentityPool MyPool -ADAccountName "Domain\account","domain\account2" -Force 
 
 
    SuccessfulAccountsCount       FailedAccountsCount    FailedAccounts 
    -----------------------       -------------------    -------------- 
                          2                         0    {}

Removes two accounts (account and account2) from the identity pool called "MyPool", leaving the AD accounts untouched. The accounts are removed regardless of whether they are in the 'inUse' state or not.

-------------------------- EXAMPLE 4 --------------------------

C:\PS>Remove-AcctADAccount -IdentityPool MyPool -ADAccountName "Domain\account","domain\account2" -OutVariable result 
 
    SuccessfulAccountsCount       FailedAccountsCount    FailedAccounts 
    -----------------------       -------------------    -------------- 
    1                                               1    {account2} 
 
    C:\PS>$result[0].FailedAccounts 
 
    ADAccountName                 ADAccountSid           ErrorReason 
    -------------                 -------------          ------------ 
    Domain\account2               account2               IdentityObjectLocked

Shows failure of removal of one of two accounts and how to retrieve the failure reason.

-------------------------- EXAMPLE 5 --------------------------

C:\PS>Remove-AcctADAccount -IdentityPool MyPool -ADAccountSid S-1-5-21-1315084875-1285793635-2418178940-2685 
 
 
    SuccessfulAccountsCount       FailedAccountsCount    FailedAccounts 
    -----------------------       -------------------    -------------- 
    1                                               0    {}

Removes one account (S-1-5-21-1315084875-1285793635-2418178940-2685) from the identity pool called "MyPool", leaving the AD accounts untouched.