OK, I have clearly asked for an enhancement that apparently does not need to be made. I would cancel this post, but haven't figured out how to do that. This is the script from gparra. Maybe someone can correct my script, below. I have only included the lines that I believe are applicable. Seems like I need to build the $output using the extracted filename rather than create a specific filename. But I don't know how to do that. Can the $output line be modified to substitute the actual filename that was extracted?
$url = "$Protocol`://$HubitatHost/hub/backupDB?fileName=latest"
$output = "$BackupPath\HubitatBackup_$(get-date -f yyyy-MM-dd-HHmmss).lzf"
$LoginResponse = Invoke-WebRequest "$Protocol`://$HubitatHost/login" -SessionVariable 'Session' -Body $Body -Method 'POST'
$ProfileResponse = Invoke-WebRequest $url -OutFile $output -WebSession $Session