# PowerShell profile HowTo

When I work on Windows platform from time to time I prefer to use the PowerShell. The PowerShell is an automation platform and scripting language for Windows and Windows Server that allows you to simplify the management of your systems. Unlike other text-based shells, PowerShell harnesses the power of the .NET Framework, providing rich objects and a massive set of built-in functionality for taking control of your Windows environments.

Of course there is plenty of documentation how to use it. Here I’ll give only short tips and hope it will be helpful in daily work. The PowerShell is not a state of art, but it is a native tool for daily automation tasks. The PowerShell is usually pre-installed on Windows platform (Windows 7,8,10). The best way is to update it to the fresh version manually. To start working with PowerShell on your platform you need to do couple of things:
1. Set the execution policy;
2. Create the profile file for convenient use Let’s have a look on this in more detail.

All system manipulations with PowerShell configuration need to be executed inside the PowerShell console in Administrator mode. Profiles.ps1 is a script file. By default YOU CANNOT RUN any scripts. This is because the execution policy is set to Restricted. Without making the following configuration change you may get an ERROR message:
‘The execution of scripts is disabled’.

In Windows search field input Windows PowerShell, highlight it, press Ctrl+Shift+Enter and confirm the Administrator mode.

As soon as you will be in Administrator mode console please Enter:

PS> Set-ExecutionPolicy RemoteSigned

The next step is to check if profile file exist:

PS> Test-Path $PROFILE If you see “False” then create one: PS> New-Item -path$PROFILE -type file –force

If you want list the file:

PS> gc $PROFILE I recommend to edit this file by Windows PowerShell ISE (Integrated Scripting Engine) which is already pre-installed on your system: PS> ise$PROFILE

If you prefer to use common profile file for all users and all hosts you can create it by:

PS> New-Item -path $PROFILE.AllUsersAllHosts -type file –force And edit it by: PS> ise$PROFILE.AllUsersAllHosts

The last one. If you wanna create the own aliases, here is example how to do it. Let’s create the alias for rapid exit by q letter:

<# Main Profile #>
# Set Aliases
Set-Alias q quit
# Set Functions
function quit {exit}
function ll {Get-ChildItem -Force}
function PSadmin {Start-Process powershell -Verb runAs}

The ll alias will list the hidden files. PSadmin will run the PowerShell in Administrator mode also.

Have a good day.