You got to Zip it up – Compress-Archive and .Net

Compression of files or folders and quickly detecting the environments capabilities

If you happen to work for an MSP, you will quickly become use to needing to take into consideration a lot of variables such as

  • Who will be using the script
    • Non-technical Service Desk
    • Technical Service Desk
    • Desktop Engineers
    • or highly skilled users such s SOE/MOE or Server Engineers
  • What Operating System
  • What PowerShell version

Just because you have PowerShell, you might not be using the right version on all computers in the environment. I still have a 2003 server with PowerShell version 2 and a lots of my past customers were running 2008r2.

You may find yourself wanting to reduce the size of a file or folder, especially if you plan on pulling rather large log files from a Domain Controller in place of using a normal backup solution.

PowerShell 5.0 includes compress-archive, which is very easy to use.

Compress-Archive -Path .\source -DestinationPath .\destination.zip 

Wonderful, but remember I mentioned older operating systems and PowerShell versions. Yep, well, PowerShell v4 does not have this command however…

Continue reading “You got to Zip it up – Compress-Archive and .Net”