Skip to content

Commit eb0aa1d

Browse files
Invoke-DbaDbLogShipping: Add -IgnoreFileChecks parameter (#10219)
1 parent 8dacfa2 commit eb0aa1d

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

public/Invoke-DbaDbLogShipping.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,10 @@ function Invoke-DbaDbLogShipping {
366366
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
367367
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
368368
369+
.PARAMETER IgnoreFileChecks
370+
Skips path validation checks before backup operations. Use this when SQL Server cannot verify that the backup path exists,
371+
for example when the network share is created just before the backup and there is latency in the path becoming visible to SQL Server.
372+
369373
.PARAMETER Force
370374
Bypasses confirmations and applies default values for missing parameters like copy destination folder.
371375
Also removes existing schedules with the same name and sets automatic database suffix when source and destination instances are identical.
@@ -575,6 +579,7 @@ function Invoke-DbaDbLogShipping {
575579
[string]$StandbyDirectory,
576580
[switch]$UseExistingFullBackup,
577581
[string]$UseBackupFolder,
582+
[switch]$IgnoreFileChecks,
578583
[switch]$Force,
579584
[switch]$EnableException
580585
)
@@ -1527,12 +1532,13 @@ function Invoke-DbaDbLogShipping {
15271532
} else {
15281533
# Backup to file share
15291534
$splatBackup = @{
1530-
SqlInstance = $SourceSqlInstance
1531-
SqlCredential = $SourceSqlCredential
1532-
BackupDirectory = $DatabaseSharedPath
1533-
BackupFileName = "FullBackup_$($db.Name)_PreLogShipping_$Timestamp.bak"
1534-
Database = $($db.Name)
1535-
Type = "Full"
1535+
SqlInstance = $SourceSqlInstance
1536+
SqlCredential = $SourceSqlCredential
1537+
BackupDirectory = $DatabaseSharedPath
1538+
BackupFileName = "FullBackup_$($db.Name)_PreLogShipping_$Timestamp.bak"
1539+
Database = $($db.Name)
1540+
Type = "Full"
1541+
IgnoreFileChecks = $IgnoreFileChecks
15361542
}
15371543

15381544
$LastBackup = Backup-DbaDatabase @splatBackup

tests/Invoke-DbaDbLogShipping.Tests.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Describe $CommandName -Tag UnitTests {
9090
"StandbyDirectory",
9191
"UseExistingFullBackup",
9292
"UseBackupFolder",
93+
"IgnoreFileChecks",
9394
"AzureBaseUrl",
9495
"AzureCredential",
9596
"Force",

0 commit comments

Comments
 (0)