Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .INFORMATION
- ====================================================================================
- Made with: PrimalPad
- Made by: Christer
- Organization: A2G Gruppen AS
- .DESCRIPTION
- ====================================================================================
- IMPORTANT!
- First INSTALL this MODULE:
- - Run PowerShell as administrator and enter the install commands below
- [AZSBTools] Used for getting the dates, like the first tuesday of the month
- Install-Module AZSBTools -Force -AllowClobber -Scope CurrentUser -SkipPublisherCheck
- The Optimize-Volume cmdlet optimizes a volume, performing defragmentation, trim, slab consolidation, and storage tier processing.
- If no parameter is specified, then the default operation will be performed per the drive type as follows.
- HDD, Fixed VHD, Storage Space. -Analyze -Defrag.
- Tiered Storage Space. -TierOptimize.
- SSD with TRIM support. -Retrim.
- Storage Space (Thinly provisioned), SAN Virtual Disk (Thinly provisioned), Dynamic VHD, Differencing VHD. -Analyze -SlabConsolidate -Retrim.
- SSD without TRIM support, Removable FAT, Unknown. No operation.
- This script will only run on the first friday of the month.
- Schedule it to run every friday.
- #>
- $TargetDate = Get-DayOfMonth -DayOfWeek Friday -First
- $Today = Get-Date
- if ($Today -like $TargetDate) {
- DISM /Online /Cleanup-Image /RestoreHealth
- Repair-Volume -DriveLetter C -SpotFix
- Optimize-Volume -DriveLetter C -ReTrim -Verbose
- } else {
- Exit
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement