PowerShell environment setup

Portfolio Slicer comes with a set of Microsoft Windows PowerShell Scripts that helps you manage data in external files. PowerShell is pre-installed on every Microsoft Windows Operating System (OS) so you do not need to install it. But by default PowerShell is configured not to run any scripts. You will need to enable script execution on PowerShell.

How to enable script execution on PowerShell

  1. On your Windows 8+ computer press “Windows Logo” key and type in “cmd” - windows will search for available applications and will show you “Command Prompt” application. You will need to do right mouse click on that application and choose option “Run as Administrator” as per this screenshot:
    “User Account Control” dialog should popup to ask you to confirm that you want to allow this application make changes to this PC. You should click “Yes”.
  2. In the “Administrator: Command Prompt window enter command “powershell.exe” - this will start PowerShell environment. Your command window prompt should change from “C:\Windows\system32>” to “PS C:\Windows\system32>”.
  3. Type in command “Get-ExecutionPolicy” and hit Enter key. PowerShell will return your current script execution policy. If value is “Restricted”, that means you have to change it. If value returned is “Unrestricted”, then you can close window and do not execute next steps, because your PowerShell is already configured to run scripts. Please remember your existing script execution policy setting before changing. Later you can always set it back to original value.
  4. Decide what Script Execution Policy you want to enable on your machine. You have a choice to change PowerShell execution policy to “AllSigned”, “RemoteSigned” and “Unrestricted”. If you know how to “Sign Scripts”, then you can use “AllSigned” or “RemoteSigned” options. If you do not know how to “Sign Scripts”, then you should use “Unrestricted” script execution policy. More about PowerShell script execution policies can be found here. Note: Portfolio Slicer team does not bear responsibility for this choice.
  5. Change your PowerShell script execution policy by using command “Set-ExecutionPolicy”. To do so type “Set-ExecutionPolicy” followed by space and execution policy code, example:
    Set-ExecutionPolicy Unrestricted
  6. Confirm that your execution policy was changed by typing in command:
  7. Enter command “exit” to exit PowerShell environment.
  8. Enter again command “exit” to close “Command Prompt” window.
  9. Your PowerShell is now configured to execute scripts.

Screen shot of executed commands:

Note: If you will attempt to change PowerShell script execution policy in command prompt window that was not started as administrator, then you will get error message like this:

set-executionpolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied. To change the execution policy for the default (LocalMachine) scope, start Windows PowerShell with the "Run as administrator" option. To change the execution policy for the current user, run "Set-ExecutionPolicy -Scope CurrentUser". At line:1 char:1 + set-executionpolicy unrestricted + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
To resolve this issue please start "Command Prompt" window as administrator as per "Step 1" instructions.

You will need to setup PowerShell script execution policy on your computer just once during initial setup. After that you will be able to execute all PowerShell scripts until you change policy back.

Video instructions - How to setup PowerShell