Extract various archives with PowerShell

Nowadays, instead of using .zip, .rar or .7z files, I find myself using virtual harddrives (.vhdx) more and more as it’s so much more convenient. However, extracting large amounts of compressed files, can be a very time consuming endeavor. Here a quick and dirty PowerShell script to do this. I’ve added a check for determining if the archive one folder in the root of the archive or if it contains multiple files and folders. If it contains just the one folder, the script won’t create a new folder and extract that one folder into the new folder. Instead it will “extract here”. If multiple files and/or folders are found, it will create a new folder based on the archive name. The script assumes you have 7zip installed on the default location.