Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Backup script
- # v1.0
- # This script checks a day of week and do daily or full backup on external
- # storage
- # ============================= Main environment define =======================
- # Number of day of week
- $CurrentDay = Get-Date -uFormat %u
- # Number of day of week which full backup is run
- $FullBackupDay = 5
- # Filename - current day at format "year-mm-dd"
- $FileName = get-date -Format yyyy-MM-dd
- # add-content -path c:\backup.txt -value "run"
- #======== TEST filename ===========
- # $FileName = "far2"
- # The path to the directory that will be archived
- $FromPath = "x:\share\"
- #======== The TEST!!! path to the directory that will be archived ====
- # $FromPath = "x:\share\test\"
- # The path to the directory that will be archived
- $ToPath = "\\backup\storage"
- # Backup command
- $Command = "C:\windows\system32\ntbackup.exe"
- # Daily Options
- $Daily = "/M daily"
- # Full Options
- $Full = "/M copy"
- # Different Options
- $Different = "/M different"
- ##################
- # options formerly
- $Options = "backup $FromPath /SNAP:on /HC:off /V:no /F $ToPath\$FileName.bkf"
- # ============================== main backup procedure ========================
- # Write-Host "Different backup run"
- #
- # $OptionsDifferent = "$Options $Different"
- # echo $OptionsDifferent
- #
- # Start-Process $Command $OptionsDifferent
- #
- if ($CurrentDay -ne $FullBackupDay)
- {
- Write-Host "Daily backup run"
- $OptionsDaily = "$Options $Daily"
- echo $OptionsDaily
- Start-Process $Command $OptionsDaily
- }
- else
- {
- Write-Host "Full backup run now"
- $OptionsFull = "$Options $Full"
- echo $OptionsFull
- Start-Process $Command $OptionsFull
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement