Created
February 6, 2015 09:01
-
-
Save raducugheorghe/43ae1cb1fd6ea93e47e6 to your computer and use it in GitHub Desktop.
[Powershell] Backup website and database from script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module SQLPS -DisableNameChecking | |
Import-Module PSCX | |
$dt = Get-Date -Format yyyyMMddHHmmss | |
$dbname = 'DBNAME' | |
Backup-SqlDatabase -ServerInstance .\SQLEXPRESS -Database $dbname -BackupFile "C:\Backups\$($dbname)_db_$($dt).bak" | |
write-zip "C:\WebSites\SITENAME\*" "C:\Backups\$($dbname)_website_$($dt).zip" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment