Citrix Virtual Apps and Desktops SDK

Remove-XDController

Removes a Delivery Controller from an existing Site

Syntax

Remove-XDController
      -ControllerName <String>
      [-DoNotUpdateDatabaseServer]
      [-AdminAddress <String>]
      [<CommonParameters>]
<!--NeedCopy-->
Remove-XDController
      -ControllerName <String>
      -DatabaseCredentials <PSCredential>
      [-AdminAddress <String>]
      [<CommonParameters>]
<!--NeedCopy-->
Remove-XDController
      -ControllerName <String>
      -LoggingDatabaseCredentials <PSCredential>
      -MonitorDatabaseCredentials <PSCredential>
      -SiteDatabaseCredentials <PSCredential>
      [-AdminAddress <String>]
      [<CommonParameters>]
<!--NeedCopy-->

Description

Removes a Controller from an existing Site that currently has more than one Controller.

If no credentials are provided and DoNotUpdateDatabaseServer has not been specified, then all database update operations are attempted using the credentials of the user running the cmdlet.

If DatabaseCredentials is provided, then all database operations are attempted using the credentials.

If one or more of SiteDatabaseCredentials, LoggingDatabaseCredentials or MonitorDatabaseCredentials are provided, then all three must be provided. All operations are then attempted using the credentials appropriate to each Database.

Examples

EXAMPLE 1

Removes the Controller ‘MyControllerToRemove’ from the Site to which ‘MyExistingController’ is joined. The permissions associated with ‘MyControllerToRemove’ will be automatically removed from the Database using the implicit credentials of the user running the cmdlet.

Remove-XDController -AdminAddress MyExistingController -ControllerName MyControllerToRemove
<!--NeedCopy-->

EXAMPLE 2

Removes the Controller ‘MyControllerToRemove’ from the Site to which ‘MyExistingController’ is joined.

The permissions for ‘MyNewController’ will not be removed from the Database. Instead the Get-XDDatabaseSchema cmdlet is used to generate a SQL script that may be given to the database administrator of ‘MySQLServer’. The SQL script may be used to remove the permissions that previously allowed ‘MyControllerToRemove’ to manipulate data within the Database.

Remove-XDController -AdminAddress MyExistingController -ControllerName MyControllerToRemove -DoNotUpdateDatabaseServer
Get-XDDatabaseSchema -AdminAddress MyExistingController -SiteName MySite -DatabaseServer MySQLServer -ScriptType RemoveController -ControllerToRemoveSid MyControllerToRemove_SID > C:\removeController.sql
# Although not necessary, Citrix recommends you get a database administrator to run removeController.sql
<!--NeedCopy-->

EXAMPLE 3

Removes the Controller ‘MyControllerToRemove’ from the Site to which ‘MyExistingController’ is joined.

The credentials contained within ‘$credential’ will be used to remove the permissions associated with ‘MyControllerToRemove’ from the Database.

$credential = Get-Credential
Remove-XDController -AdminAddress MyExistingController -ControllerName MyControllerToRemove -DatabaseCredentials $credential
<!--NeedCopy-->

EXAMPLE 4

Removes the Controller ‘MyControllerToRemove’ from the Site to which ‘MyExistingController’ is joined.

The credentials contained within ‘$credentialSite’ will be used to remove the permissions associated with ‘MyControllerToRemove’ from the Site Configuration Database. The credentials contained within ‘$credentialLogging’ will be used to remove the permissions associated with ‘MyControllerToRemove’ from the Configuration Logging Database. The credentials contained within ‘$credentialMonitor’ will be used to remove the permissions associated with ‘MyControllerToRemove’ from the Monitoring Database.

$credentialSite = Get-Credential
$credentialLogging = Get-Credential
$credentialMonitor = Get-Credential
Remove-XDController -AdminAddress MyExistingController -ControllerName MyControllerToRemove -SiteDatabaseCredentials $credentialSite -LoggingDatabaseCredentials $credentialLogging -MonitorDatabaseCredentials $credentialMonitor
<!--NeedCopy-->

Parameters

-ControllerName

The name of the Controller that is to be removed. This may be in SID, DNS or SAM name form. This cannot be the same as the Controller identified by AdminAddress.

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

-DatabaseCredentials

The security credentials, in the form of a PSCredential object, that will be used to connect to the SQL Servers associated with the Site Configuration, Configuration Logging and Monitoring Databases.

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

-LoggingDatabaseCredentials

The security credentials, in the form of a PSCredential object, that will be used to connect to the SQL Server associated with the Configuration Logging Database.

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

-MonitorDatabaseCredentials

The security credentials, in the form of a PSCredential object, that will be used to connect to the SQL Server associated with the Monitoring Database.

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

-SiteDatabaseCredentials

The security credentials, in the form of a PSCredential object, that will be used to connect to the SQL Server associated with the Site Configuration Database.

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

-AdminAddress

Specifies the address of the Delivery Controller to which the PowerShell module will connect. This can be provided as a host name or an IP address.

Type: String
Position: Named
Default value: Localhost. Once a value is provided by any cmdlet, this value will become the default.
Required: False
Accept pipeline input: False
Accept wildcard characters: False

-DoNotUpdateDatabaseServer

Results in the permissions associated with the Controller not being automatically removed from the Database.

This switch may be useful when the person running the cmdlet has insufficient database privilege. The database permissions for the Controller must be removed manually after running this cmdlet.

Get-XDDatabaseSchema may be used to generate the SQL script which in turn may be used to remove the associated permissions from the Database.

This parameter results in all supplied credentials being ignored.

Type: SwitchParameter
Position: Named
Default value: None
Required: False
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

None

You cannot pipe input to this cmdlet.

Outputs

None

By default, this cmdlet returns no output.

Notes

If the user running this cmdlet does not have privilege to remove users from the Database, then either use the DoNotudpateDatabaseServer switch or supply alternative credentials using one or more of the Credentials arguments.

This cmdlet cannot be used to remove the last Controller from a Site; use the Remove-XDSite cmdlet instead.

The command can fail for the following reasons:

  • The Site has only one Controller. A Site must have multiple Controllers before a Controller can be removed.
  • The Controller that is to be removed is not a member of the Site.
  • The person running the cmdlet, or the supplied credentials, does not have sufficient privilege to update the Database. Either run this cmdlet as a user that has administrator privilege to the Database, or supply an account with suitable privileges using the PSCredential parameter(s).
Remove-XDController