Thursday, 29 December 2016

How to customize the Powershell Prompt

9:56 pm
By default when you open up Powershell console, you will get a screen as shown below :

so today we are going to learn how to replace the PS C:\windows\system32> with any thing lets say I ♥ PowerShell. So lets learn how to do it.

STEP 1 : 

We are going to modify the Powershell Profile for this. So open PowerShell as Administrator & give the below command : 

Test-Path $Profile

If it return True that means Powershell profile is created, if it's False then create the powershell profile by executing the below comand : 

New-Item -Path $PROFILE -Type File -Force

STEP 2 :

Since the Profile is now created, now open the profile in Notepad i.e. 

notepad $Profile

STEP 3 :

Now Copy-Paste the below function in that file and Save it.

You can the change the content as per your choice.

If any message or warning comes then change the encoding type while saving (Since I am using a Heart Shape by default ANSI Encoding will not support it.) 

Once Saved now close the Powershell console and Open it again and see what you got now!!

Hope you all liked this Post. Do Like, Share and Comment.

Tuesday, 15 March 2016

How to Zip and UnZip files using PowerShell

11:31 am

Today we are going to Learn all about Compressing and Decompressing a file using Powershell. So lets get started.

Powershell 5.0 have lots of features added to its feather. One of them is Zipping and Unzipping . Powershell 5.0 contains 2 functions by default for Zipping and Unzipping a file i.e. Compress-Archive and Expand-Archive

Syntax :

Zip : Compress-Archive -path <Source_File_Path> -DestinationPath <Destination_File>

Unzip : Expand-Archive -path <Zip_file_path_to_Extract> -DestinationPath <Destination_path_where_to_Extract> 

>_ If you are using Powershell version below 5.0 then you can achieve the same by Calling a Class.


Add-Type -Assembly "System.IO.Compression.FileSystem" ;
[System.IO.Compression.ZipFile]::CreateFromDirectory("E:\The Powershell Geek", "E:\")


Add-Type -Assembly "System.IO.Compression.FileSystem"
[System.IO.Compression.ZipFile]::ExtractToDirectory("E:\", "E:\")

Hope you all liked it.. Keep Learning and do share. If you have any queries related to Powershell then do comment we will take it up in our next post.

Saturday, 5 March 2016

Execution Policy in Powershell

3:59 pm
How to get and set the Execution Policy

Execution Policy in Powershell

Execution Policy in Powershell helps to determine the type of scripts that can run on a particular system. 

There are different types of Execution Policy in Powershell :


It is the default execution policy in Powershell. It means it doesn't allow any Powershell script(*.ps1) to execute by default. In order to provide security, Microsoft suggests Restricted policy by default so that none of malicious code can be executed by double clicking or running it. 


All the Scripts should have a digital signature from a trusted publisher, then only you will be able to execute the Script else Script will not be executed. This is applicable for the local scripts also which you write of your own, you will need to assign a certificate to it example Self Signed Certificate.

Local script files doesn't need any signature( they can be executed) but scripts downloaded from any internet source will require Signature from a Trusted publisher in order to get executed. 


This Policy is not recommended by Microsoft since it allows any script to run , although it will prompt for permission if the script is downloaded from Internet. This policy is least secure so avoid keeping this. 


This works on the same functionality of Unrestricted policy. Only difference is we can skip the prompt for permission in Bypass.

How to Find and Set the Execution Policy :

Set-ExecutionPolicy <Type_Of_ExecutionPolicy> e.g. Set-ExecutionPolicy RemoteSigned

Hope you all like the post. Keep commenting, and DO SHARE!

Contact us


Email *

Message *