The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

PowerShell is King – A Data Deduplication script that runs the Optimization,Garbage Collection and Scrubbing in a single sweep, including progress

Posted by Mikael Nystrom on April 28, 2017

I use Windows Server 2016 on all my lab machines, therefore I also use Data Deduplication to save space. But I don’t run it in the background, i run it basically when I need space.

The PowerShell script. (https://github.com/DeploymentBunny/Files/tree/master/Tools/Start-VIADeDupJob)


Function Wait-VIADedupJob
{
while ((Get-DedupJob).count -ne 0 )
{
Get-DedupJob
Start-Sleep -Seconds 30
}
}

foreach($item in Get-DedupVolume){
Wait-VIADedupJob
$item | Start-DedupJob -Type Optimization -Priority High -Memory 80
Wait-VIADedupJob
$item | Start-DedupJob -Type GarbageCollection -Priority High -Memory 80 -Full
Wait-VIADedupJob
$item | Start-DedupJob -Type Scrubbing -Priority High -Memory 80 -Full
Wait-VIADedupJob
}
Get-DedupStatus

/mike

One Response to “PowerShell is King – A Data Deduplication script that runs the Optimization,Garbage Collection and Scrubbing in a single sweep, including progress”

  1. Doug said

    Any reason not to use the -Wait parameter on the Start-DedupJob commands? You get that oh so pretty Powershell progress bar at the top.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: