Try this script. It will handle all aspects of copying a database including, checking space on the target drive, checking if the required certificates are present on the target machine, checking the compatibility of the SQL versions. It will run in 1 line, and will apply all required configurations, such as setting the compatibility level to match the new version, setting the recovery level, optionally copying users and logins, or restoring the original permissions of the target database, etc.
See the Wiki
https://github.com/MikeyMing/powershell-sql/wiki/BackupAndRestore
Please feel free to contribute.
Thanks