Skip to content

Commit

Permalink
Updated README.md and finished setup for release.
Browse files Browse the repository at this point in the history
  • Loading branch information
mpb10 committed Aug 14, 2018
1 parent b9cfd33 commit aa30aae
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 19 deletions.
47 changes: 43 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# PowerShell-Backup-Script
https://github.com/mpb10/PowerShell-Backup-Script

A PowerShell script used to backup files.
A PowerShell script used to back up files and folders.


**Author: Matt Bittner**
**Author: mpb10**

**May 9th, 2018**
**August 13th, 2018**

**v2.0.0**

Expand All @@ -21,12 +21,51 @@ A PowerShell script used to backup files.

# INSTALLATION

**Script download link:** https://github.com/mpb10/PowerShell-Backup/releases/download/v2.0.0/PowerShell-Backup-v2.0.0.zip

**Requires:** PowerShell 5.0 or greater*

*Version 5.0 of PowerShell comes pre-installed with Windows 10 but otherwise can be downloaded here: https://www.microsoft.com/en-us/download/details.aspx?id=50395

#

**To Install:**

1. Ensure that you have PowerShell Version 5.0 or greater installed.
2. Download the release .zip file and extract it to a folder.
3. Run the 'Installer' shortcut located in the `\install` folder (or run the the script using the 'PowerShell-Backup - Portable Version' shortcut, navigate to the settings menu, and choose the `2 - Install script to:` option).

A desktop shortcut and a Start Menu shortcut will be created. Run either of those to use the script. The install location is `C:\Users\%USERNAME%\Scripts\PowerShell-Backup`.

#

To uninstall this script and its files, delete the two folders `C:\Users\%USERNAME%\Scripts\PowerShell-Backup` and `%APPDATA%\Microsoft\Windows\Start Menu\Programs\PowerShell-Backup` and the desktop shortcut.

# USAGE

Run either the desktop shortcut or the Start Menu shortcut. Use option 1 of the main menu to backup a single folder. Use option 2 and the `Backuplist.txt` file to backup multiple folders at once in a batch job.

Upon being ran for the first time, the script will generate the `BackupList.txt` file in the `\config` folder. To use option `2 - Backup from list` of the main menu, list folder paths under their respective stanzas in the `BackupList.txt` file, save it, and then run option 2 of the script.

# CHANGE LOG

2.0.0 August 13th, 2018
Re-wrote the script in the likeness of PowerShell-Youtube-dl. Cleaned up code.
Can backup individual folders or use the BackupList.txt file to run batch jobs.
Implemented some logging to the temp folder.

1.1.1 June 23rd, 2017
Uploaded to Github.
Condensed installer to one PowerShell script.
Edited documentation.

1.1.0 June 12th, 2017
Added ability to back up folders listed in backuplist.txt.
# ADDITIONAL NOTES

This script uses the 7-Zip program to compress folders for backing up. 7-Zip is licensed under the GNU LGPL license and its source code can be found at http://www.7-zip.org/.
**NOTE:** This script utilizes 7-zip command line version 9.20 executable file. This version of 7-zip has been identified as being vulnerable to multiple code execution exploits via crafted archive files. Since the executable is only used to create archives, the danger these vulnerabilities pose are negligable as long as the 7-zip executable is only used by the script to create archives. This version of 7-zip is only used because of its ability to be easily downloaded and installed. To easily mitigate the vulnerabilities found in version 9.20, simply download 7-zip version 18.05 or higher and copy the file `7z.exe` to the `\bin` directory.

This script uses the 7-Zip program to compress folders for backing up. 7-Zip is licensed under the GNU LGPL license and its source code can be found at https://www.7-zip.org/.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 changes: 15 additions & 15 deletions backup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
.NOTES
Requires PowerShell version 5.0 or greater.
Author: mpb10
Updated: May 16th, 2018
Updated: August 13th, 2018
Version: 2.0.0
.LINK
https://github.com/mpb10/PowerShell-Backup
Expand Down Expand Up @@ -99,7 +99,7 @@ $BackupFromFileStatus = $True

# Function for simulating the 'pause' command of the Windows command line.
Function PauseScript {
If ($PSBoundParameters.Count -eq 0) {
If ($CommandLine -eq $False) {
Write-Host "`nPress any key to continue ...`n" -ForegroundColor "Gray"
$Wait = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp")
}
Expand Down Expand Up @@ -152,7 +152,7 @@ Function ScriptInitialization {

$Script:BackupListFile = $ConfigFolder + "\BackupList.txt"
If ((Test-Path "$BackupListFile") -eq $False) {
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/install/files/BackupList.txt" "$ConfigFolder\BackupList.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/install/files/BackupList.txt" "$ConfigFolder\BackupList.txt"
}
}

Expand All @@ -179,11 +179,11 @@ Function InstallScript {

Copy-Item "$PSScriptRoot\backup.ps1" -Destination "$RootFolder"

DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/install/files/PowerShell-Backup.lnk" "$RootFolder\PowerShell-Backup.lnk"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/install/files/PowerShell-Backup.lnk" "$RootFolder\PowerShell-Backup.lnk"
Copy-Item "$RootFolder\PowerShell-Backup.lnk" -Destination "$DesktopFolder\PowerShell-Backup.lnk"
Copy-Item "$RootFolder\PowerShell-Backup.lnk" -Destination "$StartFolder\PowerShell-Backup.lnk"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/LICENSE" "$RootFolder\LICENSE.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/README.md" "$RootFolder\README.md"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/LICENSE" "$RootFolder\LICENSE.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/README.md" "$RootFolder\README.md"

Write-Host "`nInstallation complete. Please restart the script." -ForegroundColor "Yellow"
PauseScript
Expand All @@ -195,7 +195,7 @@ Function InstallScript {


Function UpdateScript {
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/install/files/version-file" "$TempFolder\version-file.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/install/files/version-file" "$TempFolder\version-file.txt"
[Version]$NewestVersion = Get-Content "$TempFolder\version-file.txt" | Select -Index 0
Remove-Item -Path "$TempFolder\version-file.txt"

Expand All @@ -204,21 +204,21 @@ Function UpdateScript {
$MenuOption = Read-Host "`nUpdate to this version? [y/n]"

If ($MenuOption.Trim() -like "y" -or $MenuOption.Trim() -like "yes") {
DownloadFile "http://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/backup.ps1" "$RootFolder\backup.ps1"
DownloadFile "http://github.com/mpb10/PowerShell-Backup/raw/master/backup.ps1" "$RootFolder\backup.ps1"

If ($PSScriptRoot -eq "$InstallLocation") {
If ((Test-Path "$StartFolder") -eq $False) {
New-Item -Type Directory -Path "$StartFolder" | Out-Null
}

DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/install/files/Youtube-dl.lnk" "$RootFolder\PowerShell-Backup.lnk"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/install/files/Youtube-dl.lnk" "$RootFolder\PowerShell-Backup.lnk"
Copy-Item "$RootFolder\PowerShell-Backup.lnk" -Destination "$DesktopFolder\PowerShell-Backup.lnk"
Copy-Item "$RootFolder\PowerShell-Backup.lnk" -Destination "$StartFolder\PowerShell-Backup.lnk"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/LICENSE" "$RootFolder\LICENSE.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/README.md" "$RootFolder\README.md"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/LICENSE" "$RootFolder\LICENSE.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/README.md" "$RootFolder\README.md"
}

DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/version-2.0.0/install/files/UpdateNotes.txt" "$TempFolder\UpdateNotes.txt"
DownloadFile "https://github.com/mpb10/PowerShell-Backup/raw/master/install/files/UpdateNotes.txt" "$TempFolder\UpdateNotes.txt"
Get-Content "$TempFolder\UpdateNotes.txt"
Remove-Item "$TempFolder\UpdateNotes.txt"

Expand Down Expand Up @@ -531,7 +531,7 @@ If ($CheckForUpdates -eq $True -and $Install -eq $False) {

If ((Test-Path "$TempFolder\powershell-backup_log.log") -eq $True) {
If ((Get-ChildItem "$TempFolder\powershell-backup_log.log").Length -gt 25000000) {
Remove-Item -Path "$TempFolder\powershell-backup_log.log"
Get-Content "$TempFolder\powershell-backup_log.log" | Select-Object -Skip 50000 | Out-File "$TempFolder\powershell-backup_log.log"
}
}

Expand All @@ -541,14 +541,14 @@ If ((Test-Path "$BinFolder\7za.exe") -eq $False -and $Install -eq $False) {
}

If (($PSBoundParameters.Count) -gt 0) {
$CommandLine = $True
CommandLineMode
}
Else {
$CommandLine = $False
MainMenu
}

Write-Host "End of Script"
PauseScript
Exit


Expand Down
2 changes: 2 additions & 0 deletions install/files/UpdateNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
1. Re-wrote the script in the likeness of PowerShell-Youtube-dl. Cleaned up code.

2. Can backup individual folders or use the BackupList.txt file to run batch jobs.

3. Implemented some logging to the temp folder.

===================================================================================================

0 comments on commit aa30aae

Please sign in to comment.