Skip to content

chrisguest75/powershell_examples

Repository files navigation

README

Repository

Powershell examples.

Contents

📋 Prereqs

Windows

Ensure that Powershell is upgraded to the latest version here

Switch the terminal app to point to C:\Program Files\PowerShell\7\pwsh.exe to start and configure oh-my-posh chrisguest75/powershell_examples/17_ohmyposh/README.md

MacOS

# current version
brew info powershell 

# install
brew install powershell

# upgrade
brew upgrade powershell

WSL Ubuntu

It looks like Linux Brew does not have Powershell for Linux.

Based on powershell/scripting/install/install-ubuntu

###################################
# Prerequisites

# Update the list of packages
sudo apt-get update

# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common

# Get the version of Ubuntu
source /etc/os-release

# Download the Microsoft repository keys
wget -q https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb

# Register the Microsoft repository keys
sudo dpkg -i packages-microsoft-prod.deb

# Delete the the Microsoft repository keys file
rm packages-microsoft-prod.deb

# Update the list of packages after we added packages.microsoft.com
sudo apt-get update

###################################
# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

$PSVersionTable

Test

# open shell
pwsh

# check versions
$psversiontable

# list the currently installed modules.
Get-InstalledModule
Get-Module -ListAvailable   

# Troubleshooting
# if modules are failing to load and you already have the modules installed try upgrading them.
Update-AWSToolsModule  

🏠 Enable brew

# add brew support to powershell
Add-Content -Path $PROFILE.CurrentUserAllHosts -Value '$(/usr/local/bin/brew shellenv) | Invoke-Expression'

00 - Basic Commands

Demonstrate some basic commands in Powershell
Steps README.md

01 - Template

A template script as an example to create others.
Steps README.md

02 - JSON

Demonstrate how to deal with json data in Powershell
Steps README.md

03 - Docker

Demonstrate how to run powershell inside a docker container
Steps README.md

04 - Mongo Module

Demonstrate how to install and use a mongo packages
Steps README.md

05 - Pester

Demonstrate how to run pester to test a script
Steps README.md

06 - AWS CLI

Demonstrate how to use AWS cli and parse answers with powershell.
Steps README.md

07 - String Generation

Demonstrate text generation effects.
Steps README.md

08 - Iterate Folders

Demonstrate iterating over files and directories
Steps README.md

09 - Jupyter

Demonstrate how to get a jupyter server running
Steps README.md

10 - awsbatch

Demonstrate using the official AWS Powershell Module for Batch
Steps README.md

10 - awsecs

Demonstrate using the official AWS Powershell Module for ECS
Steps README.md

11 - logging

Demonstrate logging libraries for Powershell
Steps README.md

12 - remoting

Configure SSH Remoting in Powershell.
Steps README.md

17 - oh-my-posh

Demonstrate some oh-my-posh basics.
Steps README.md

19 - PSScriptAnalyzer

Demonstrate use of PSScriptAnalyzer to lint code.
Steps README.md

20 - pode webserver

Use pode to build a simple webserver.
Steps README.md

20 - AST

Demonstrate use to parser and AST on scripts.
Steps README.md

22 - dotnet

Demonstrate using dotnet core libraries
Steps README.md

24 - trint apis

Demonstate using trint live API
Steps README.md

25 - windows helpers

A set of helpers for working with Windows.
Steps README.md

👀 Resources

  • Official product documentation for PowerShell here
  • adamdriscoll/awesome-powershell repo here
  • Use cheatsheet powershell
  • PowerShell/PowerShell repo here

About

Examples of Powershell Core scripts and snippets

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published