Listing backup header and file list information
In this recipe, we will look at listing backup header information from a backup file.
Getting ready
For this task, we will look at listing an existing backup's header information.
Note
If you do not have any backups in your system yet, you can do any of this chapter's backup recipes prior to performing this recipe.
How to do it...
To list the header information, follow these steps:
Open the PowerShell console by going to Start | Accessories | Windows PowerShell | Windows PowerShell ISE.
Import the
SQLPS
module as follows:#import SQL Server module Import-Module SQLPS -DisableNameChecking
Add the following script and run:
$instanceName = "KERRIGAN" $server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName $smoRestore = New-Object Microsoft.SqlServer.Management.Smo.Restore #replace this with your backup file $backupfile = "AdventureWorks2008R2_Full_20120205231407.bak" #change this to where your backup directory...