A friend asked how to set compression on a file using PowerShell. It took a little digging and a few wrong turns but it turns out to be quite simple:


$file = Get-WmiObject -Class CIM_DataFile -Filter "Name='c:\\temp\\test.txt'" 
$file.Compress()

Cheers, Dan

Sorry, comments are closed for this article.