This PowerShell module provides cmdlets for backup.
- Variables:
backupDestRootDir
- Cmdlets:
Backup-Files
- If
srcBasePath
andsrcRelPath
passed, then create base destination directory under thebackupDestRootDir
, and replicate the relative part under the base directory. - If only
srcBasePath
passed, then replicate the base file or directory just under thebackupDestRootDir
. - The destination base file or directory name is constructed by
hostname
+ sanitizedsrcBasePath
, to avoid collision.
- If
Get-FirefoxProfileDirName
- Firefox profile directory name like
xxxxxxxx.default
.
- Firefox profile directory name like
Backup-FirefoxBookmarksHTML
- Backup
%AppData%\Mozilla\Firefox\Profiles\xxxxxxxx.default\bookmarks.html
- Require
browser.bookmarks.autoExportHTML
istrue
.
- Backup
Backup-GoogleChromeBookmarksJSON
- Backup
%LocalAppData%\Google\Chrome\User Data\Default\Bookmarks
.
- Backup
Save-ChocolateyInstalledPackageList
- Save Chocolatey installed package list to
$(MyDocuments)\ConfigDumps\chocolatey\packages.config
.
- Save Chocolatey installed package list to
Save-NPMGlobalInstalledPackageList
- Save npm global installed package list to
$(MyDocuments)\ConfigDumps\npm\ls.txt
.
- Save npm global installed package list to
Save-TfsLocalChangesAsShelveset
- Shelve TFS local changes on workspaces.
- Shelveset naming rule is same as the destination name construction of
Backup-Files
. - Use
tf
command of vs2013-2017.
Import-Module BackupUtils
$backupDestRootDir = "F:\Backups"
# Documents
$myDocs = [Environment]::GetFolderPath("MyDocuments")
Backup-Files $myDocs "ConfigDumps"
Backup-Files $myDocs "Visual Studio 2017\Projects" @("Visual Studio 2017\Projects\PROJECT_TO_IGNORE")
Backup-Files $myDocs "Visual Studio 2017\Settings"
Backup-Files $myDocs "WindowsPowerShell"
# Applications
$appData = [Environment]::GetFolderPath("ApplicationData")
$user = [Environment]::GetFolderPath("User")
Backup-Files $appData "Code\User" # VS Code Settings
Backup-Files $user ".vscode" # VS Code Extensions
# Bookmarks
Backup-Files ([Environment]::GetFolderPath("Favorites")) # IE
Backup-FirefoxBookmarksHTML
Backup-GoogleChromeBookmarksJSON
# TFS
$workspaces = (Join-Path ([Environment]::GetFolderPath("UserProfile")) "Source\Workspaces")
Save-TfsLocalChangesAsShelveset (Join-Path $workspaces "MyFirstProject")
PS> cd (Join-Path ([Environment]::GetFolderPath("MyDocuments")) "WindowsPowerShell\Modules")
PS> git clone https://github.com/lpubsppop01/BackupUtils-PSModule.git BackupUtils