Add-AcctADAccount
Import existing Active Directory (AD) computer accounts for use in the AD Identity Service.
Syntax
Add-AcctADAccount
[-IdentityPoolName] <String>
-ADAccountName <String[]>
[-Password <String>]
[-SecurePassword <SecureString>]
[-ADUserName <String>]
[-ADPassword <SecureString>]
[-LoggingId <Guid>]
[<CitrixCommonParameters>]
[<CommonParameters>]
Add-AcctADAccount
-IdentityPoolUid <Guid>
-ADAccountName <String[]>
[-Password <String>]
[-SecurePassword <SecureString>]
[-ADUserName <String>]
[-ADPassword <SecureString>]
[-LoggingId <Guid>]
[<CitrixCommonParameters>]
[<CommonParameters>]
Description
Provides the ability for Active Directory (AD) computer accounts that already exist in AD to be used by the Citrix AD Identity Service and other Citrix Machine Creation Services.
All aspects of this command that need to make modifications to the accounts in AD will do so using the account that the PowerShell runspace is using. This means that if the passwords need resetting for the accounts, the user performing the operation in PowerShell must have sufficient privileges in AD for this operation to complete successfully. If the current user does not have sufficient privileges, the ADUserName and ADPassword parameters may be used instead.
The following rules apply to the importing of AD accounts:
If the current account password is supplied, the cmdlet will attempt to change the password so that it is known only to the Citrix Identity Service. This uses password change operations and does not need AD account administration permissions.
If the current password is not supplied, the cmdlet will attempt to reset the password for the AD account so that it is known only to the Citrix Identity Service. This requires the user to have enough privileges in AD to reset the account passwords.
Imported accounts in a disabled or locked state in AD are imported with the account marked in an error state.
If the identity pool into which accounts are being imported does not have a domain set, the domain of the identity pool will be set to the domain of the first account imported.
Examples
EXAMPLE 1
Import the two accounts (account and account2) from AD into the identity Pool called "MyPool"
Add-AcctADAccount -IdentityPoolName MyPool -ADAccountName "Domain\account","Domain\account2" -OutVariable result
SuccessfulAccounts SuccessfulAccountsCount FailedAccountsCount FailedAccounts
------------------ ----------------------- ------------------- --------------
{domain\account, domain\account2} 2 0 {}
$result.SuccessfulAccounts
ADAccountGuid : 473f5534-48ac-4baf-831f-376c5b813b60
ADAccountName : domain\account
ADAccountSid : S-1-5-21-1315084875-1285793635-2418178940-2644
AccountDisabled : False
AccountLocked : False
Domain : Domain.com
DomainControllerHint :
Lock : False
State : Available
TenantId :
DeviceManagementType : None
IdentityType : ActiveDirectory
VdaHostId :
WorkgroupMachine : False
TrustServiceInstanceId :
ADAccountGuid : 7f23cdaa-072f-4eab-bca5-c2b18cd30c06
ADAccountName : domain\account2
ADAccountSid : S-1-5-21-1315084875-1285793635-2418178940-2645
AccountDisabled : False
AccountLocked : False
Domain : Domain.com
DomainControllerHint :
Lock : False
State : Available
TenantId :
DeviceManagementType : None
IdentityType : ActiveDirectory
VdaHostId :
WorkgroupMachine : False
TrustServiceInstanceId :
Parameters
-IdentityPoolName
The name of the identity pool in which the accounts are to be imported.
| Type: | String |
| Position: | 2 |
| Default value: | None |
| Required: | True |
| Accept pipeline input: | True (ByPropertyName) |
| Accept wildcard characters: | False |
-ADAccountName
The name of the AD account to be imported. 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
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Required: | True |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-IdentityPoolUid
The unique identifier for the identity pool in which the accounts are to be imported.
| Type: | Guid |
| Position: | Named |
| Default value: | None |
| Required: | True |
| Accept pipeline input: | True (ByPropertyName) |
| Accept wildcard characters: | False |
-Password
The current password for the computer account.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Required: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-SecurePassword
The current password for the account (provided in a Secure String class).
| Type: | SecureString |
| Position: | Named |
| Default value: | None |
| Required: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-ADUserName
The username for an AD user account with Write Permissions. This parameter must be used if the current user does not have the necessary privileges.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Required: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-ADPassword
The matching password for an AD user account with Write Permissions. This parameter must be used if the current user does not have the necessary privileges.
| Type: | SecureString |
| Position: | Named |
| Default value: | None |
| Required: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
-LoggingId
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.
| Type: | Guid |
| Position: | Named |
| Default value: | None |
| Required: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
CitrixCommonParameters
This cmdlet supports the common Citrix parameters: -AdminAddress, -AdminClientIP, -BearerToken, -TraceParent, -TraceState and -VirtualSiteId. For more information, see about_CitrixCommonParameters.
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
None
You can't pipe objects to this cmdlet.
Outputs
Citrix.ADIdentity.Sdk.AccountOperationDetailedSummary
The Add-AcctADAccount returns an object that contains the following properties:
-
SuccessfulAccountsCount \<int\>The number of accounts that were added successfully
-
FailedAccountsCount \<int\>The number of accounts that were not added.
-
FailedAccounts \<Citrix.XDPowerShell.AccountError\[\]\>The list of accounts that failed to be added. Each one has the following properties:
-
ADAccountName \<string\>
-
ADAccountSid \<String\>
-
ErrorReason \<ADIdentityStatus\>This can be one of the following:
-
UnableToConvertDomain
-
UnableToAccessAccountProperties
-
IdentityNotLocatedInDomain
-
UnableToAccessAccountProperties
-
IdentityDuplicateObjectExists
-
IdentityObjectLocked
-
IdentityObjectInUse
-
FailedToConnectToDomainController
-
FailedToExecuteSearchInAD
-
FailedToAccessComputerAccountInAD
-
FailedToSetPasswordInAD
-
FailedToChangePasswordInAD
-
ADServiceDatabaseError
-
ADServiceDatabaseNotConfigured
-
ADServiceStatusInvalidDb
-
-
DiagnosticInformtion \<Exception\>Any other error information
-
-
SuccessfulAccounts \<Citrix.ADIdentity.Sdk.Identity\[\]\>The list of accounts that were successfully added. Each one has the following properties:
-
ADAccountGuid \<Guid\>The unique identifier for the account.
-
ADAccountName \<string\>The name of the account.
-
ADAccountSid \<string\>The SID for the account.
-
AccountDisabled \<bool\>Whether or not the account is disabled in AD.
-
AccountLocked \<bool\>Whether or not the account is locked in AD.
-
Domain \<string\>The domain for the account.
-
DomainControllerHint \<string\>
-
Lock \<bool\>Whether or not the account is locked (in the database, not AD).
-
State \<Citrix.ADIdentity.Sdk.ADIdentityState\>The state for the account. This can be:
-
AvailableThe account is not used.
-
InUseThe account is in use.
-
ErrorThe account is in error (i.e. the account is locked or disabled in AD).
-
TaintedThe account is no longer used, but the password is no longer known.
-
-
TenantId \<Guid\>The identity of the tenant associated with this account.
-
DeviceManagementType \<string\>The device management type.
-
IdentityType \<string\>The identity type.
-
VdaHostId \<Guid\>The ID of the VDA associated with this account.
-
WorkgroupMachine \<bool\>Whether or not the account is a workgroup account (not domain-joined).
-
TrustServiceInstanceId \<string\>The trust service ID of the machine.
-
Notes
To maintain maximum security when using the command programmatically, Citrix recommends you use the 'SecurePassword' property instead of the 'Password' property.
In the case of failure, the following errors can result:
-
IdentityPoolAlreadyLockedThe specified identity pool was locked by another operation.
-
IdentityPoolNotFoundThe specified identity pool was not found.
-
IdentityDuplicateObjectExistsThe specified AD account already exists for the identity pool.
-
PermissionDeniedThe user does not have administrative rights to perform this operation.
-
ConfigurationLoggingErrorThe operation could not be performed because of a configuration logging error
-
DatabaseErrorAn error occurred in the service while attempting a database operation.
-
DatabaseNotConfiguredThe operation could not be completed because the database for the service is not configured.
-
ServiceStatusInvalidDbAn error occurred in the service while attempting a database operation - communication with the database failed for various reasons.
-
CommunicationErrorAn error occurred while communicating with the service.
-
ExceptionThrownAn unexpected error occurred. To locate more details, see the Windows event logs on the controller being used, or examine the Citrix Virtual Apps and Desktops logs.