Articles in this section

How to restore Plesk installation on a new Windows server after disaster?

Plesk for Windows kb: how-to ABT: Group B

Applicable to:

  • Plesk for Windows

Question

How to restore Plesk installation on a new Windows server after disaster?

Answer

Note: on the new server, the same version of Plesk as on the old one should be installed to the same path, and it should be licensed properly. Also, the same set of components and extensions should be installed on the new server.

We strongly recommend restoring the server from a server backup. It will be the best way to solve the issue.

Also, the following instructions can be used, but we can not guarantee no issue will be faced.

Please note that server configuration (paths) should be exactly the same.

Let us assume that:

CONFIG_TEXT: plesk_dir = C:\Program Files (x86)\Plesk
plesk_vhosts = C:\Inetpub\vhosts\

Create a server with exactly the same version of Plesk with the same set of tools installed, with the same DB providers and same IP addresses.

Mount HDD from crashed server on the new server (we assume it is D:\).

Connect to the server using RDP.

Plesk Obsidian
  1. Open Plesk Services Monitor, click the Select All and then the Stop button in order to stop all Plesk services:

  2. Copy Web Presence Builder folders:

    • From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\sb\config

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\sb\config

    • From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\sb\sites\

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\sb\sites\

  3. Copy applications cache folder:

    From:

    CONFIG_TEXT: D:\Program Files (x86)\Plesk\var\apspackages

    To:

    CONFIG_TEXT: C:\Program Files (x86)\Plesk\var\apspackages

  4. Copy Horde DB password file as follows:

    From:

    CONFIG_TEXT: D:\Program Files (x86)\Plesk\Webmail\horde\conf.horde.shadow

    To:

    CONFIG_TEXT: C:\Program Files (x86)\Plesk\Webmail\horde\conf.horde.shadow

  5. Copy Plesk databases:

    From:

    CONFIG_TEXT: D:\Program Files (x86)\Plesk\MySQL\Data

    To:

    CONFIG_TEXT: C:\Program Files (x86)\Plesk\MySQL\Data

  6. Copy websites content:

    From:

    CONFIG_TEXT: D:\Inetpub\vhosts

    To:

    CONFIG_TEXT: C:\Inetpub\vhosts

  7. Copy mail content:

    • For MailEnable Server:

      From:

      CONFIG_TEXT: D:\Plesk\Mail Servers\Mail Enable\Config
      D:\Plesk\Mail Servers\Mail Enable\Postoffices
      D:\Plesk\Mail Servers\Mail Enable\Queues

      To:

      CONFIG_TEXT: C:\Plesk\Mail Servers\Mail Enable\Config
      C:\Plesk\Mail Servers\Mail Enable\Postoffices
      C:\Plesk\Mail Servers\Mail Enable\Queues

    • For SmarterMail Server:

      It will copied in the end of the instruction. Just follow the next steps.

  8. Copy Databases:

    • For MySQL databases:

      From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\Databases\MySQL

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\Databases\MySQL

    • For MSSQL databases:

      From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data

      Attach MSSQL databases using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  9. Export sym_key to be able to restore users and passwords:

    1. Open Windows Registry and load D:\Windows\System32\config\SOFTWARE hive according to Load or Unload Registry Hives.
    2. Export NEW_HIVE\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PLESK\PSA Config\Config\sym_key from the loaded hive.
    3. Unload hive, edit the path in exported registry file removing the temp folder name and double-click on it to import.
  10. Open Plesk Services Monitor, click the Select All and then the Start button in order to start all Plesk services:

  11. Run Command Prompt as Administrator.

  12. Restore MSSQL password for the sa user via MSSQL Management Studio .

  13. Reconfigure MSSQL Webadmin by executing these commands one by one:

    C:\> "%plesk_cli%/repair.exe" --reconfigure-mssql-webadmin-site
    C:\> "%plesk_cli%/repair.exe" --update-mssql-users-permissions

  14. Restore MS SQL users and databases

    C:\> "%plesk_cli%/repair.exe" --mssql

  15. Find and rename/delete all .Security files in the vhosts folders:

    C:\> for /F "skip=1 usebackq" %r in (`plesk db -e "select name from domains"`) do move "%plesk_vhosts%"\%r\.plesk\.Security "%plesk_vhosts%"\%r\.plesk\.Security.old

  16. Back to the Command Line Console and re-create all system users by executing commands:

    C:\> "%plesk_cli%\repair.exe" --synchronize-impersonation-storage
    C:\> "%plesk_cli%\repair.exe" --repair-all-webspaces-system-users

  17. Repair vhosts permissions:

    C:\> plesk repair fs -y

  18. Go to Tools & Settings > Server components > and click Refresh Server Components

  19. Back to the Command Line Console and repair SSL certificates:

    C:\> plesk repair web -sslcerts

  20. Recreate domains in IIS Web server by executing these commands:

    C:\> plesk repair web -y

  21. Reconfigure FTP by running this command:

    C:\> plesk repair ftp -y

  22. Reconfigure Mail server by launching this command:

    C:\> plesk repair mail -y

    Note: in case of Horde webmail issues, if Plesk version is 18.0.68 or lower its possible to reinstall it. Otherwise it will not be available and should be changed

  23. Run the command below to update DNS zones:

    C:\> plesk repair dns -y

  24. Copy SmarterMail content:

    From:

    CONFIG_TEXT: D:\SmarterMail

    To:

    CONFIG_TEXT: C:\SmarterMail

Plesk Onyx and Plesk 12.5
  1. Open Plesk Services Monitor, click the Select All and then the Stop button in order to stop all Plesk services:

  2. Copy Web Presence Builder folders:

    • From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\sb\config

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\sb\config

    • From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\sb\sites\

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\sb\sites\

  3. Copy applications cache folder:

    From:

    CONFIG_TEXT: D:\Program Files (x86)\Plesk\var\apspackages

    To:

    CONFIG_TEXT: C:\Program Files (x86)\Plesk\var\apspackages

  4. Copy Horde DB password file as follows:

    From:

    CONFIG_TEXT: D:\Program Files (x86)\Plesk\Webmail\horde\conf.horde.shadow

    To:

    CONFIG_TEXT: C:\Program Files (x86)\Plesk\Webmail\horde\conf.horde.shadow

  5. Copy Plesk databases:

    • If it is located on MySQL server:

      From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\MySQL\Data

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\MySQL\Data

    • If it is located on MSSQL server:

      From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data

      Attach Plesk database using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  6. Copy websites content:

    From:

    CONFIG_TEXT: D:\Inetpub\vhosts

    To:

    CONFIG_TEXT: C:\Inetpub\vhosts

  7. Copy mail content:

    • For MailEnable Server:

      From:

      CONFIG_TEXT: D:\Plesk\Mail Servers\Mail Enable\Config
      D:\Plesk\Mail Servers\Mail Enable\Postoffices
      D:\Plesk\Mail Servers\Mail Enable\Queues

      To:

      CONFIG_TEXT: C:\Plesk\Mail Servers\Mail Enable\Config
      C:\Plesk\Mail Servers\Mail Enable\Postoffices
      C:\Plesk\Mail Servers\Mail Enable\Queues

    • For SmarterMail Server:

      It will copied in the end of the instruction. Just follow the next steps.

  8. Copy Databases:

    • For MySQL databases:

      From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\Databases\MySQL

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\Databases\MySQL

    • For MSSQL databases:

      From:

      CONFIG_TEXT: D:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data

      To:

      CONFIG_TEXT: C:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data

      Attach MSSQL databases using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  9. Open Plesk Services Monitor, click the Select All and then the Start button in order to start all Plesk services:

  10. Run Command Prompt as Administrator.

  11. Set Plesk Administrator password exactly the same as on the crashed server by using steps from this article:

    How to retrieve/reset password of Plesk Administrator (admin) user in Plesk for Windows?

    If you have any issues with resetting a password by using this command, restore MySQL password for the admin user according to the following article:

    How to reset MySQL administrator password on Windows

  12. Restore MSSQL password for the sa user via MSSQL Management Studio .

  13. Reconfigure MSSQL Webadmin by executing these commands one by one:

    C:\> "%plesk_cli%/repair" --reconfigure-mssql-webadmin-site

    C:\> "%plesk_cli%/repair" --update-mssql-users-permissions

  14. Find and rename/delete all .Security files in the vhosts folders:

    C:\> for /F "skip=1 usebackq" %r in (`plesk db -e "select name from domains"`) do move "%plesk_vhosts%"\%r\.plesk\.Security "%plesk_vhosts%"\%r\.plesk\.Security.old

  15. Reset passwords for all Plesk entities by using steps from this article:

    Plesk Mass Password Reset script

  16. Back to the Command Line Console and create all system usersby executing these commands:

    C:\> "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT su.login,accounts.password,su.home FROM sys_users su LEFT JOIN accounts ON su.account_id=accounts.id" > accounts.list.txt
    > for /f "skip=1 tokens=1-3" %x in (accounts.list.txt) do "%plesk_bin%\usermng.exe" --add --name=%x --password=%y --home=%z

  17. Run Plesk Reconfigurator, click the Repair Plesk Installation button, mark the Plesk Virtual Hosts security checkbox only and click the Check button in order to recreate systems users and restore their permissions:

  18. Go to Tools & Settings > Server components > and click Refresh Server Components

  19. Back to the Command Line Console and repair SSL certificates:

    C:\> plesk repair web -sslcerts

  20. Recreate domains in IIS Web server by executing these commands:

    C:\> plesk repair web -y

  21. Reconfigure FTP by running this command:

    C:\> plesk repair ftp -y

  22. Reconfigure Mail server by launching this command:

    C:\> plesk repair mail -y

    Note: in case of issues with the Horde webmail reinstall it.

  23. Run the command below to update DNS zones:

    C:\> plesk repair dns -y

  24. Copy SmarterMail content:

    From:

    CONFIG_TEXT: D:\SmarterMail

    To:

    CONFIG_TEXT: C:\SmarterMail

Plesk 10.x-12.0
  1. Stop all Plesk services in Plesk Services Monitor:

    pleskmonitor.png

  2. Copy Web Prescense Builder configuration and websites:

    D:\Program Files (x86)\Plesk\sb\config to C:\Program Files (x86)\Plesk\sb\config.

    D:\Program Files (x86)\Plesk\sb\sites to C:\Program Files (x86)\Plesk\sb\sites

  3. Copy applications cacheD:\Program Files (x86)\Plesk\var\apspackages into C:\Program Files (x86)\Plesk\var\apspackages.

  4. Copy Horde DB password from D:\Program Files (x86)\Plesk\Webmail\horde\conf\.horde.shadow to C:\Program Files (x86)\Plesk\Webmail\horde\conf\.horde.shadow.

  5. Copy Plesk databases:

    MySQL - copy D:\Program Files (x86)\Plesk\MySQL\Data to C:\Program Files (x86)\Plesk\MySQL\Data
    MSSQL - copy D:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data to C:\Program Files (x86)\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data Attach Plesk database using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  6. Copy content from D:\Inetpub\vhosts to C:\Inetpub\vhosts.

  7. Copy mail content:

    MailEnable Server - D:\Plesk\Mail Servers\Mail Enable , folders Config , Postoffices , Queues .

    SmarterMail Server - copy D:\SmarterMail to C:\SmarterMail with content only at the end of this instruction.

  8. Copy Databases from D:\Program Files (x86)\Plesk\Databases\MySQL to C:\Program Files (x86)\Plesk\Databases\MySQL.

    The same operation for C:\Plesk\Databases\MSSQL Attach MSSQL databases using Microsoft SQL Server Management Studio or any other MSSQL Management Utility.

  9. Copy certificates from D:\Program Files (x86)\Plesk\var\certificates to C:\Program Files (x86)\Plesk\var\certificates.

  10. Start Plesk services in Plesk Services Monitor

  11. Set Administrator password in cmd exactly the same as on crashed server:

    C:\> "%plesk_bin%\plesksrvclient.exe" -set setup

  12. Restore MSSQL "sa" password with MSSQL Management Studio .

    Reconfigure MSSQL Webadmin:

    C:\> "%plesk_cli%/repair" --reconfigure-mssql-webadmin-site
    C:\> "%plesk_cli%/repair" --update-mssql-users-permissions

  13. Find and rename/delete all '.Security' files in vhosts folders:

    For Plesk 11 and Plesk 10.x:

    C:\> for /F "skip=1 usebackq" %r in (`dbclient.exe --direct-sql "--sql=select name from domains"`) do move "%plesk_vhosts%"\%r\.Security "%plesk_vhosts%"\%r\.Security.old

    For Plesk 11.5 and Plesk 12.0:

    C:\> for /F "skip=1 usebackq" %r in (`dbclient.exe --direct-sql "--sql=select name from domains"`) do move "%plesk_vhosts%"\%r\.plesk\.Security "%plesk_vhosts%"\%r\.plesk\.Security.old

  14. Open Windows Registry and load D:\Windows\System32\config\SOFTWARE hive according to Load or Unload Registry Hives.
    Export NEW_HIVE\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\PLESK\PSA Config\Config\sym_key from loaded hive. Unload hive, edit the path in exported registry file removing the temp folder name and double-click on it to import.

  15. Create all system users in Windows OS:

    C:\> "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT su.login,accounts.password,su.home FROM sys_users su LEFT JOIN accounts ON su.account_id=accounts.id" > accounts.list.txt
    for /f "skip=1 tokens=1-3" %x in (accounts.list.txt) do "%plesk_bin%\usermng.exe" --add --name=%x --password=%y --home=%z

  16. Run Plesk Reconfigurator and perform Repair Plesk Installation > Plesk Virtual Hosts security - it recreates systems users and restores permissions.

  17. Recreate domains in IIS Web server:

    For Plesk 11.0:

    C:\> "%plesk_bin%\websrvmng.exe" --reconfigure-all

    For Plesk 11.5 and Plesk 12.0:

    C:\> "%plesk_bin%\dbclient.exe" --direct-sql --sql="SELECT displayName FROM domains" > domains.txt
    C:\> for /f "skip=1" %i in (domains.txt) do "%plesk_dir%\bin\repair.exe" --reconfigure-web-site -web-site-name %i
    C:\> "%plesk_dir%\bin\repair.exe" --synchronize-protected-directories-storage
    C:\> "%plesk_dir%\bin\repair.exe" --repair-all-webspaces-security
    C:\> "%plesk_dir%\bin\repair.exe" --synchronize-impersonation-storage
    C:\> "%plesk_dir%\bin\repair.exe" --synchronize-protected-directories-storage
    C:\> for /f "tokens=*" %d in ('type C:\domains.txt') do "%plesk_dir%\bin\repair.exe" --repair-webspace-security -webspace-name %d

  18. Reconfigure FTP:

    For Plesk 11.0:

    C:\> "%plesk_bin%\ftpmng.exe" --reconfigure-all

    For Plesk 11.5 and Plesk 12.0:

    C:\> "%plesk_dir%\bin\repair.exe" --reconfigure-ftp-sites

  19. Reconfigure Mail server:

    C:\> "%plesk_bin%\mchk.exe" --all --fix=all

    Note: In case of Webmail issues please reinstall Horde

  20. Update DNS zones:

    C:\> "%plesk_bin%\dnsmng.exe" update *

  21. Copy SmarterMail content if required.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.