Created
March 9, 2020 13:37
-
-
Save edingc/1d4a021958fc551fae3d71a821e43c50 to your computer and use it in GitHub Desktop.
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
$Keep = 3 | |
$Today = (Get-Date).DayOfWeek | |
# Cleanup if Monday | |
If ( $Today -eq "Monday" ) { | |
Write-Host "Running TSM cleanup." | |
& tsm maintenance cleanup | |
} | |
# Run TSM Backup | |
Write-Host "Running TSM backup." | |
& tsm maintenance backup -f tableau -d | |
# Remove Older Backups | |
Get-ChildItem "C:\ProgramData\Tableau\Tableau Server\data\tabsvc\files\backups" | Where-Object { $PSItem.Name -like "*.tsbak" } | Select-Object -SkipLast $Keep | Remove-Item -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment