Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
Not really an error message but when using a path variable and if you specified the dbname token in the path, then the path will have database twice : at the position of the token AND at the end of the path.
example :
when backup like that :
$MSSQLInstances | Get-DbaDatabase -ExcludeDatabase "tempdb" | Backup-DbaDatabase -Type $BackupType -CompressBackup -Checksum -Verify -FileCount $FileCount -Path "${BackupDirectory}\servername\instancename\dbname\backuptype" -FilePath "servername_dbname_backuptype_timestamp.${BackupExtension}" -TimeStampFormat "yyyyMMdd_HHmm" -ReplaceInName -CreateFolder -WarningVariable WarningVariable -EnableException -Whatif
What if: Performing the operation "Creating a new path on MYMSSQL" on target "G:\BACKUPDB\MYMSSQL\MSSQLSERVER\ReportServer\Full\ReportServer".
What if: Performing the operation "Backing up ReportServer to G:\BACKUPDB\MYMSSQL\MSSQLSERVER\ReportServer\Full\ReportServer\MYMSSQL_ReportServer_Full_20231025_1553.bak" on target "MYMSSQL".
Steps to Reproduce
# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
$BackupType = "FULL"
$FileCount = 1
$CMSInstance="localhost\DBA01"
$BackupDirectory="G:\BACKUPDB"
switch ( $BackupType )
{
"Full"
{
$BackupExtension="bak"
}
"Diff"
{
$BackupExtension="bak"
}
"Log"
{
$BackupExtension="trn"
}
}
$MSSQLInstances = Get-DbaRegServer -SqlInstance $CMSInstance -Group ALL | Select-Object -Unique -ExpandProperty ServerName
$MSSQLInstances | Get-DbaDatabase -ExcludeDatabase "tempdb" | Backup-DbaDatabase -Type $BackupType -CompressBackup -Checksum -Verify -FileCount $FileCount -Path "${BackupDirectory}\servername\instancename\dbname\backuptype" -FilePath "servername_dbname_backuptype_timestamp.${BackupExtension}" -TimeStampFormat "yyyyMMdd_HHmm" -ReplaceInName -CreateFolder -WarningVariable WarningVariable -EnableException -Whatif
Please confirm that you are running the most recent version of dbatools
2.1.4
Other details or mentions
No response
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe)
PowerShell Host Version
Name Value
PSVersion 7.3.7
PSEdition Core
GitCommitId 7.3.7
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
SQL Server Edition and Build number
Microsoft SQL Server 2019 (RTM-CU18) (KB5017593) - 15.0.4261.1 (X64) Sep 12 2022 15:07:06 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)
.NET Framework Version
.NET 7.0.11
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
Not really an error message but when using a path variable and if you specified the dbname token in the path, then the path will have database twice : at the position of the token AND at the end of the path.
example :
when backup like that :
$MSSQLInstances | Get-DbaDatabase -ExcludeDatabase "tempdb" | Backup-DbaDatabase -Type $BackupType -CompressBackup -Checksum -Verify -FileCount $FileCount -Path "${BackupDirectory}\servername\instancename\dbname\backuptype" -FilePath "servername_dbname_backuptype_timestamp.${BackupExtension}" -TimeStampFormat "yyyyMMdd_HHmm" -ReplaceInName -CreateFolder -WarningVariable WarningVariable -EnableException -WhatifWhat if: Performing the operation "Creating a new path on MYMSSQL" on target "G:\BACKUPDB\MYMSSQL\MSSQLSERVER\ReportServer\Full\ReportServer".
What if: Performing the operation "Backing up ReportServer to G:\BACKUPDB\MYMSSQL\MSSQLSERVER\ReportServer\Full\ReportServer\MYMSSQL_ReportServer_Full_20231025_1553.bak" on target "MYMSSQL".
Steps to Reproduce
Please confirm that you are running the most recent version of dbatools
2.1.4
Other details or mentions
No response
What PowerShell host was used when producing this error
Windows PowerShell (powershell.exe)
PowerShell Host Version
Name Value
PSVersion 7.3.7
PSEdition Core
GitCommitId 7.3.7
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
SQL Server Edition and Build number
Microsoft SQL Server 2019 (RTM-CU18) (KB5017593) - 15.0.4261.1 (X64) Sep 12 2022 15:07:06 Copyright (C) 2019 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: ) (Hypervisor)
.NET Framework Version
.NET 7.0.11