Author | Stuart Moore (@napalmgram), stuart-moore.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaBackupInformation on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaBackupInformation.
Tests a dbatools backup history object is correct for restoring
Input is normally from a backup history object generated from Format-DbaBackupInformation
. This is then parse to check that it's valid for restore. Tests performed include:
Test-DbaBackupInformation
[-BackupHistory] <Object[]>
[[-SqlInstance] <DbaInstanceParameter>]
[[-SqlCredential] <PSCredential>]
[-WithReplace]
[-Continue]
[-VerifyOnly]
[-OutputScriptOnly]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> $BackupHistory | Test-DbaBackupInformation -SqlInstance MyInstance
PS C:\> $PassedDbs = $BackupHistory | Where-Object {$_.IsVerified -eq $True}
PS C:\> $FailedDbs = $BackupHistory | Where-Object {$_.IsVerified -ne $True}
Pass in a BackupHistory object to be tested against MyInstance.
Those records that pass are marked as verified. We can then use the IsVerified property to divide the failures and successes
dbatools BackupHistory object. Normally this will have been process with Select-
and then Format-DbaBackupInformation
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The Sql Server instance that wil be performing the restore
Alias | |
Required | False |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default we won't overwrite an existing database, this switch tells us you want to
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Switch to indicate a continuing restore
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
This switch indicates that you only wish to verify a restore, so runs a smaller number of tests as you won't be writing anything to the restore server
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Switch to disable path creation. Will write a warning that a path does not exist
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
Prompts you for confirmation before running the cmdlet.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |