# Windows

## The simplest way to update the HES server.

1. Stop the server from IIS
2. Download the zip file from <https://update.hideez.com/hes/windows_x64_latest.zip>
3. Extract binary files from the zip archive to your HES folder
4. Start the server from IIS

## Recommended updating the HES server with backup&#x20;

### 1. Backup the HES binaries and the configuration file

* Copy existed folder `C:\Hideez\HES` to `C:\Hideez\HES_old`

### 2. Backup SQL Database

For MySQL database:

* YOUR\_DB\_NAME – The database name may be different for you, depending on how you have named it on install.
* You will need to enter the MySQL root password.

```
> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
>  .\mysqldump -u root -p YOUR_DB_NAME > "C:\Hideez\HES.old\YOUR_DB_NAME.sql"
```

For Microsoft SQL Server database:

* Go to the SQL Server Management Studio
* Right-click on the database name Select Tasks > Backup Select "Full" as the backup type Select "Disk" as the destination Click on "Add..." to add a backup file and type `C:\Hideez\HES_old\`YOUR\_DB\_NAME`.bak` and click "OK" Click "OK" again to create the backup

### 3. Download and install the latest HES

Download the zip file from <https://update.hideez.com/hes/windows_x64_latest.zip>, then unzip its content to the folder `C:\Hideez\HES`.

### 4. Restoring the configuration file

Copy `C:\Hideez\HES_old\appsettings.Production.json` to `C:\Hideez\HES\appsettings.Production.json` in the File Explorer

### 5. Starting the HES

Start the site  using  the IIS console

## If something goes wrong, you can restore the HES server and Database server using the following steps:

1. Stop the site using the IIS console, then rename the old folder to HES,
2. Then restore the database:

**For MySQL database:**

```
> cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
> Get-Content  "C:\Hideez\HES_old\YOUR_DB_NAME.sql" | .\mysql.exe  -u root -p YOUR_DB_NAME
```

**For Microsoft SQL Server database:**

* In the SQL Server Management Studio:
* In the left navigation bar, right-click on `Databases` and then click `Restore Database`.
* In the `Source` section, select `Devic`e and click the button with three dots and type `C:\Hideez\HES_old\YOUR_DB_NAME.bak`
* In the pop-up window that opens, click `Add` and browse for your backup file. Click `OK`.
* In the left navigation menu, click `Options`.
* In the pane on the right, select `Overwrite the existing database (WITH REPLACE)` and `Close existing connections to destination database`.
* Click `OK`.

3. Then start the site using the IIS console.

## Update using a script

In the latest versions, there is another way to update the server – using the **PowerShell** script **update.ps1**, which is located in the directory with the server (C:/Hideez/HES/update.ps1). This script has the following command line parameters:

-service - Name of IIS site. Default HES&#x20;

-url - URL to download the update file. The default, URL will be taken from <https://update.hideez.com/hes/build.json>

But you can override these parameters. For example, to update HES offline, from the file "windows\_x64\_latest.zip", located in the C:/Updates directory, you can run the script in PowerShell, as follows: &#x20;

`update.ps1 -url file://C:/Updates/windows_x64_latest.zip`
