Powershell In Case Of

Powershell In Case Of

2018-02-09. Category & Tags: Powershell, Windows

Use Microsoft Terminal #

choco install -y microsoft-windows-terminal

Customizing PS Prompt (Use ConEmu) #

See more in [codeship].

install chocolatey (i.e. win pkg manager) #

option 1 [chocolatey official]: #

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) # install choco

choco install conemu -y

# Install PowerShell modules
Install-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name 'posh-git'

option 2, with Git together codeship: #

# Set your PowerShell execution policy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force

# Install Chocolatey
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

# Install Chocolatey packages
choco install git.install -y
choco install conemu -y

# Install PowerShell modules
Install-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name 'posh-git'

config console emulator #

Run Start > ConEmu.
For the 1st time running, I choose the color theme “solarized”.
Follow codeship section “ConEmu” until before “PowerShell Profile”.

Open $PROFILE by:

if (!(Test-Path -Path $PROFILE)){ New-Item -Path $PROFILE -ItemType File } ; ise $PROFILE

Paste the content from here and save (Sunny modified from codeship).
OBS: the original post was wrongly spelling Get-ChildItemColor with more hyphens

Some fixes, run in any PS console with admin.

Install-Module Get-ChildItemColor

## OBS: Enabling scripting requires an answer for prompt:
Set-ExecutionPolicy -Scope LocalMachine Unrestricted
## or:
#Set-ExecutionPolicy Unrestricted

To check available colors:

Install-Module -Name TMOutput
Show-TMOutputColor

//TODO: Git etc….

Enable Running of Scripts: #

Run powershell.exe with admin rights and:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
# or
Set-ExecutionPolicy unrestricted

And answer A.

More:

powershell.exe -noprofile -executionpolicy bypass -file .\my_script.ps1

Or using reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell]
"EnableScripts"=dword:00000001 "ExecutionPolicy"="Unrestricted"

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell] "EnableScripts"=dword:00000001 "ExecutionPolicy"="Bypass"

Ref: stackoverflow 00001 “ExecutionPolicy”=“Bypass”


Ref: [stackoverflow](https://is.gd/cYit1g)