Powershell script to Extract Litespeed Databases

Quick script to decompress a bunch of litespeed backups to their native format.  This uses the extractor that comes with litespeed itself.  This will create a different directory for each uncompressed backup.

$path = "D:\Move"  #where all the compressed ls backups are
$extractor = "D:\Move\Extractor_x64.exe"  #the path to the extractor
$destPath = "D:\Move\Extract"  #where you want the litespeed to create the dirs and place uncompressed backups

#example cmd line for extracting compressed backups
#extractor_x64.exe -F"CompressedBackupName.bak" -E"UncompressedBackupName.bak" -N1

foreach($file in gci -path $path | where{$_.Extension -eq ".bak"})
    $dbName = $file.Name.Substring(0, $file.Name.lastindexof("_db_"))
    $extractDir = "$destPath\$dbName"
    mkdir $extractDir -force
    $extractFile = "$extractDir\$dbName" + ".bak"
    $params = "-F`"$($file.FullName)`"", "-E`"$($extractFile)`"", "-N1"
    & $extractor $params

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: