Backup custom metadata

It will only ever work fully, if you move to a machine which runs under the same operating system.
In general, there is this: https://support.plex.tv/articles/201539237-backing-up-plex-media-server-data/

If this is specifially about Windows, take a look at PSA: Script to back up and restore Plex app data on a Windows system

The server must be shut down during the backup, or you will be copying damaged database files.

What you need to keep in mind about a full server backup:
Even with the saved data, you will only have a chance to a full restore if your new server installation has everything just like the old server.
That mainly applies to the type of operating system,
but also the storage location of each media file.
These must be kept the same between the old and the new server, or even restoring that large backup will not be able to preserve some of the data.
You are well advised to keep a list of the plex library root level folders and their storage adresses (i.e. drive letter plus folder name, or the address of the file server/NAS unit where they are stored)
(screenshots of each library’s “Add Folders” tab should do fine)