Tuesday, May 24, 2016

Do you love sweets? I love them. And there are some Powershell cmdlets those are tooo sweet like a sweet.If you want to clear/ empty your recycle bin, there is a very sweet Powershell cmdlet available for it, which is Clear-RecycleBin .Just run the cmdlet, and it will empty your recycle bin. You can incorporate this cmdlet to your TEMP file cleaning scripts too.Clear-RecycleBin

If you just run the Clear-RecycleBin, it will ask you for Yes/No confirmation, you can - -Confirm:$false to omit it.

Clear-RecycleBin-Confirm:$false

So sweet isn't? :) I have tested the above cmdlet on Windows 10 machine :) Thanks

Friday, May 20, 2016

It's simple again, by using the Compress-Archive cmdlet. The syntax of Compress-Archive cmdlet is simple, provide the -Path of the folder which you want to compress, then provide the -DestinationPath of your .zip file and then set a -CompressionLevel, and after that hit enter.

Simple!

Compress-Archive-CompressionLevelOptimal-PathC:\temp\Data\

-DestinationPathC:\temp\aman.zip

In the the above command, I have set the -compressionLevel to Optimal , and then provided the -path of my folder which I wan to zip and then the destination path of new zip file which in aman.zip. And hit enter, in the below screenshot you can see that it has started creating a zip file.

In the below folder you can see, that our zip file is successfully created. Yayyy!!!!!