Removing a Personalization Server or Management Server database connection from the SCP using Powershell

Version 6

    Verified Product Versions

    Management Center 10.0Management Center 10.1

    Introduction

     

    If you cannot remove a database connection (EM Personalization Server or Management Server) from the SCP you may need to use a Powershell command to achieve it. The way to do this is detailed below.

    This method can also be used as part of a script or as a quicker way to remove a connection.

     

    Detail

    Firstly, ensure that the database connection is not in use by the server instance. If it is, you can change it in the SCP.

    Method 1 - version 10.0 only

    Run Powershell as an administrator, then use the following commands. You need to ensure you use the correct command to delete either a Personalization or Management Center database connection. If you need to remove a Personalization Server connection as well as a Management Server connection, you will need to close and re-open Powershell after removing the first one because the Import-ApsInstanceModule cmdlet imports the module which is valid for the entire session and cannot be changed to a different product.

     

    NOTE: In the examples below the name of the connection is within the quotation marks, you will need to substitute your own name here (this is not the database name but the connection name)

     

    Remove a Personalization Server database connection

    Import-ApsInstanceModule -ProductName "Personalization Server" -IsDefault

    Import-Module 'C:\Program Files\AppSense\Server Configuration Portal\Bin\AppSense.ServerConfigurationPortal.PowerShell.dll'

    Get-Command -Module AppSense.ServerConfigurationPortal.PowerShell

     

    Get-ApsDatabaseDetail

      Make a note of the Connection name returned by the Get-ApsDatabaseDetail command above, then:

    Remove-ApsDatabaseConnection "<connectionname>" Personalization

     

    Remove Management Center database connection:

    Import-ApsInstanceModule -ProductName "Management Server" -IsDefault

    Import-Module 'C:\Program Files\AppSense\Server Configuration Portal\Bin\AppSense.ServerConfigurationPortal.PowerShell.dll'

    Get-Command -Module AppSense.ServerConfigurationPortal.PowerShell

     

    Get-ApsDatabaseDetail

      Make a note of the Connection name returned by the Get-ApsDatabaseDetail command above, then:

    Remove-ApsDatabaseConnection "<connectionname>" Management

     

    Method 2 - version 10.0 and upwards

     

    To fix this, it is possible to manually edit the C:\ProgramData\AppSense\SCU\DatabaseConnections.xml file to remove the username and password values for the database connection:

    CAUTION: Be sure to take a backup of this file before making any changes, as this could stop the Personalization Server or Management Center from working

     

    CAUTION: Do not do this on a Personalization Server whilst users are using the system as they could fail to sync data up or down

     

    Use the following steps:

     

    1. Run Notepad elevated as Administrator
    2. Open the file C:\ProgramData\AppSense\SCU\DatabaseConnections.xml
    3. Find the entry for the database name that you want to change the settings for - it will be found in a <DatabaseConnection> tag
    4. Delete the entire section from <DatabaseConnection> to </DatabaseConnection> (including those tags)
    5. Save the file
    6. Refresh the SCP web page or log out and back in
    7. You should now find the database connection is no longer displayed

     

    NOTE: If the above method fails to remove the connection you may need to reset the server to factory defaults. See the following article for instructions: How to Reset the Server Configuration Portal to an out of box state