DBATools Get-DbaDatabase] Failure | The certificate chain was issued by an authority that is not trusted.

If  you get the error:

Get-DbaDatabase] Failure | The certificate chain was issued by an authority that is not trusted.

You can set in dbatools:

 

or

 

dbatools sql The certificate chain was issued by an authority that is not trusted.
dbatools sql The certificate chain was issued by an authority that is not trusted.

Replace a MS SQL Database in AlwaysOn AG with DBATools

There is a database in AG and you need to drop it and restore from backup (which is sometimes a transition from developer to prod )
You don’t need any prerequisite for cluster nodes and AG names.
The script find the instance in local windows server and find the db AG nodes and listener.
So finally you need the database name and the location of the backup folder which can be an Ola backup solution folder.

DBATools – powershell

Taking notes – some example:

Download and Install to my computer:

https://dbatools.io/download/

­

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted

Install-Module dbatools

if necessary:
update-module dbatools

OFFLINE:

Copy this directory to offline server:
C:\Program Files\WindowsPowerShell\Modules\dbatools

Set-Location ‘C:\Program Files\WindowsPowerShell\Modules\dbatools’ ##.\install.ps1  ## with internet access
Get-ChildItem -Recurse | Unblock-File

Continue reading “DBATools – powershell”