We have created a custom database Preview in Sitecore Sxa. We need to check this database is exist or not through Sitecore Powershell
script.
Could someone let me know how we can check database exist or not in Sitecore powershell script?
Sitecore Stack Exchange is a question and answer site for developers and end users of the Sitecore CMS and multichannel marketing software. It only takes a minute to sign up.
Sign up to join this communityTry out the below script, Just replace master
with your database name.
if(($db = Get-Database -Name "master" -ErrorAction SilentlyContinue)) {
$db
} else {
Write-Host "Does not exist."
}
Hope it helps!