From 602e263d507af91bf211b4ebce848a528ed45991 Mon Sep 17 00:00:00 2001 From: Chrissy LeMaire Date: Fri, 31 May 2019 10:46:07 +0000 Subject: [PATCH] Snapshot maybe fixes #5631 (#5660) * maybe fixes #5631 * fix that --- functions/New-DbaDbSnapshot.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions/New-DbaDbSnapshot.ps1 b/functions/New-DbaDbSnapshot.ps1 index 5e552e2e6b..d9ae0d39c1 100644 --- a/functions/New-DbaDbSnapshot.ps1 +++ b/functions/New-DbaDbSnapshot.ps1 @@ -175,7 +175,9 @@ function New-DbaDbSnapshot { ## double check for gotchas foreach ($db in $dbs) { - if ($db.IsDatabaseSnapshot) { + if ($db.IsMirroringEnabled) { + $InputObject += $db + } elseif ($db.IsDatabaseSnapshot) { Write-Message -Level Warning -Message "$($db.name) is a snapshot, skipping" } elseif ($db.name -in $NoSupportForSnap) { Write-Message -Level Warning -Message "$($db.name) snapshots are prohibited" @@ -186,7 +188,7 @@ function New-DbaDbSnapshot { } } - if ($InputObject.Length -gt 1 -and $Name) { + if ($InputObject.Count -gt 1 -and $Name) { Stop-Function -Message "You passed the Name parameter that is fixed but selected multiple databases to snapshot: use the NameSuffix parameter" -Continue -EnableException $EnableException } }