From 279e8f250f7b997f60cd8183884dad8fee8a6b52 Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 1 Apr 2023 01:11:19 -0700 Subject: [PATCH] Implementing Test-DbaPath for Testing Copy Folder for Log Shipping Secondary (#8826) --- private/functions/New-DbaLogShippingPrimaryDatabase.ps1 | 2 +- private/functions/New-DbaLogShippingSecondaryPrimary.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/private/functions/New-DbaLogShippingPrimaryDatabase.ps1 b/private/functions/New-DbaLogShippingPrimaryDatabase.ps1 index 62307450f8..5112d2b2e3 100644 --- a/private/functions/New-DbaLogShippingPrimaryDatabase.ps1 +++ b/private/functions/New-DbaLogShippingPrimaryDatabase.ps1 @@ -134,7 +134,7 @@ function New-DbaLogShippingPrimaryDatabase { Stop-Function -Message "The backup share path $BackupShare should be formatted in the form \\server\share." -Target $SqlInstance return } else { - if (-not ((Test-Path $BackupShare -PathType Container -IsValid) -and ((Get-Item $BackupShare).PSProvider.Name -eq 'FileSystem'))) { + if (-not ((Test-DbaPath $BackupShare -SqlInstance $SqlInstance -SqlCredential $SqlCredential) -and ((Get-Item $BackupShare).PSProvider.Name -eq 'FileSystem'))) { Stop-Function -Message "The backup share path $BackupShare is not valid or can't be reached." -Target $SqlInstance return } diff --git a/private/functions/New-DbaLogShippingSecondaryPrimary.ps1 b/private/functions/New-DbaLogShippingSecondaryPrimary.ps1 index a9b45c7d77..55693c377e 100644 --- a/private/functions/New-DbaLogShippingSecondaryPrimary.ps1 +++ b/private/functions/New-DbaLogShippingSecondaryPrimary.ps1 @@ -131,7 +131,7 @@ function New-DbaLogShippingSecondaryPrimary { Stop-Function -Message "The backup destination path should be formatted in the form \\server\share." -Target $SqlInstance return } else { - if (-not ((Test-Path $BackupDestinationDirectory -PathType Container -IsValid) -and ((Get-Item $BackupDestinationDirectory).PSProvider.Name -eq 'FileSystem'))) { + if (-not ((Test-DbaPath $BackupDestinationDirectory -SqlInstance $SqlInstance -SqlCredential $SqlCredential) -and ((Get-Item $BackupDestinationDirectory).PSProvider.Name -eq 'FileSystem'))) { Stop-Function -Message "The backup destination path is not valid or can't be reached." -Target $SqlInstance return }