Listing backup header and FileList information

In this recipe, we will see how to list backup header information from a backup file.

Getting ready

We need to list the existing backup's header information.

Note

If you do not have any backups in your system yet, you can go back to any of this chapter's Backup recipes prior to performing this recipe.

How to do it...

To list the header information, follow these steps:

  1. Open PowerShell ISE as administrator.
  2. Import the SQLPS module as follows:
    #import SQL Server module
    Import-Module SQLPS -DisableNameChecking
  3. Add the following script and run:
    $instanceName = "localhost" $server = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Server -ArgumentList $instanceName #replace this with your backup file $backupfile ...

Get SQL Server 2014 with PowerShell v5 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.