dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer

Home Page:https://dbatools.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backup-DbaDbMasterKey missing file extention in Filename property

bilodeauj opened this issue · comments

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

No error was reported by the command, but i noticed an issue in the path to key that was backed up, where the file extention is missing.

Steps to Reproduce

Run the Following command to backup the Database Master Key

$Computer = 'Server01'
$InstanceName = 'MSSQLSERVER'
$DMKBackup = Backup-DbaDbMasterKey -SqlInstance "$Computer\$InstanceName" -Database master -Verbose

When referencing the $DMKBackup.Path or $DMKBackup.Filename property is shows the following and the .key file extention is missing. The actual file the .key extention, however the .Path and .Filename property is missing the extention.

G:\BACKUPS\Server01-master-masterkey-20240501121231

Please confirm that you are running the most recent version of dbatools

2.1.14

Other details or mentions

When using Backup-DbaServiceMasterKey the .Path and Filename property includes the file extention, but Backup-DbaDbMasterKey doesn't. So there is an inconsistency in the behaviour

What PowerShell host was used when producing this error

Windows PowerShell ISE (powershell_ise.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.20348.643
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.20348.643
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

Microsoft SQL Server 2022 (RTM-CU12) (KB5033663) - 16.0.4115.5 (X64) Mar 4 2024 08:56:10 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: ) (Hypervisor)

.NET Framework Version

.NET Framework 4.8.4515.0

Thanks for reporting this, will open a pull request for a fix shortly.