Showing posts with label Powershell Tutorials. Show all posts
Showing posts with label Powershell Tutorials. Show all posts

Friday, May 20, 2016

PowerShell cmdlet of the Day : Compress-Archive

In the previous blog post we have seen how to extract a ZIP file.

But what about, how you can create a zip file by using PowerShell.

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 -CompressionLevel Optimal -Path C:\temp\Data\

-DestinationPath C:\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. 

 

Aman Dhally, Manya Kaur

 

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

 

Aman Dhally, Manya Kaur

Thanks for the reading blog post.

Aman Dhally, Manya Kaur

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.

Wednesday, May 18, 2016

PowerShell cmdlet of the Day : Format-Volume

 

Do you remember old days, when we used to have Format.exe to create and format partitions? Good old days! Huh! after that comes the GUI, afterwards that everything is done by mouse clicks :D.

In windows8 and later version of it, PowerShell included a cmdlet Format-Volume, which format the new or existing partition. Cool!

You can use the Format-Volume in lot's of way, but the most basic and widely use of this command is to format a  partition.

The basic command to do it is :

Format-Volume -DriveLetter D -FileSystem NTFS -Full -Force

D1

In the above command, we are formatting the D drive and formatting as a NTFS file system and by providing -Full we are asking it to fully format it ( it will take time, if you don't use the -Full parameter , it used the -quick by default).

Simple :) isn't.

To know more about the cmdlet  visit : https://technet.microsoft.com/en-us/library/hh848665(v=wps.630).aspx 

 

With Regards.
Aman Dhally
If you like, you can follow me on Twitter and Facebook. You can also check my “You Tube channel
for PowerShell video tutorials. You can download all of my scripts from “Microsoft
TechNet Gallery”.