Showing posts with label Windows 10. Show all posts
Showing posts with label Windows 10. Show all posts

Thursday, May 19, 2016

PowerShell cmdlet of the Day : Expand-Archive

 

Yes, Yes, this was the most awaited cmdlet in the PowerShell world... Wow!! it's one of the coolest command ever exists for system admins.

Now , we can write scripts to unzip ZIP files, I mean, can write more efficient scripts to unzip files ( without using .net code).

Ok! let's be less dramatic.

If you want to unzip a zip file using PowerShell, then there is a cmdlet available for it, named Expand-Archive.

It's syntax  is simple, provide the path of .Zip file, then the path of Destination where you want to extract files. that's all!

Expand-Archive -Path C:\Users\aman.dhally\Desktop\PingData.zip

-DestinationPath C:\temp\Data\ -Force -Verbose

In the above command, we are unzipping the PindData.zip to the folder C:\temp\Data. The parameters are quite self-explanatory.

m1

In the above screenshot you can see that the above command has run successfully and it' unzip the archived.

Now you can write script to unachieve your backups. :D

:)

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”.

Tuesday, October 13, 2015

PowerShell and BitLocker : Create a Password Protected encrypted drive.

 

In the previous blog post , we discussed a little bit about BitLocker. And we  also see that how can user Get-BitLockerVolume to show us all the drives, including encrypted and non-encrypted one.

Today, we are going to see, how can we encrypt password protected drive using BitLocker Powershell module cmdlets.

When  I run the Get-BitLockerVolume cmdlet, it shows me the below output, you can see , that I have two drives are both are not encrypted.

I am interested in encrypting my Data Drive which is drive letter D:\.

Let's encrypt it.

1

To encrypt a drive, we use the Enable-BitLockerVolume cmdlet

Remember: We need to create a Secure String Password, if you want to open the BitLocker encrypted drive using Password.

$pass = ConvertTo-SecureString "Passw0rd" -AsPlainText -Force

In above command, we are creating a new secure string of text, Passw0rd, this will be out password to unlock the BitLocker encrypted drive.

Enable-BitLocker -MountPoint D:\ -EncryptionMethod Aes128 -Password $pass -PasswordProtector

 

In abov command, we are using Enable-BitLocker to encrypting our drive, in -MountPoint, we are providing the drive letter of the disk which we want to encrypt, in -EncryptionMethod we are providing, which type of encryption we are going to use, it can be either Aes128 or Aes256 , in -Password we have provided the variable $pass in which our secure string is strored, and then -PasswordProtector parameter.

 

Now it the enter, you can see that the BitLocker has started the encrypting the drive...

2

3

In the next blog post, we will see that how can we mount encrypted drives using PowerShell.

Take care till then.

Aman Dhally

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”.