Code Monkey home page Code Monkey logo

sharingiscaring's Introduction

Powershell 7 Setup v1

This is a quick and dirty guide you can follow for a badass Powershell 7 deployment on a new client.

Getting Started

This guide will help you to get started with the below:

  • Powershell 7 #new shiny shell with usefull functions.
  • scoop #usefull commandline utilities
  • chocolately #windows package manager for easy installation of software
  • Windows Terminal # Windows new shell installation and customisation
  • Windows $Profile and Functions
  • PSRemoting with SSH

Prerequisites

Internet Access & Local Administrator on the machine you wish to install PS7 on.

Installing Powershell 7

First step is to download that new juicy Powershell 7 with ye olde Powershell and run the installer. Copy the below into a Powershell window which will start the download of Powershell 7.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-WebRequest -Uri 'https://github.com/PowerShell/PowerShell/releases/download/v7.0.0/PowerShell-7.0.0-win-x64.msi' -OutFile ($home +'\downloads\PowerShell-7.0.0-win-x64.msi');
ii ($home +'\downloads\');

Installing scoop

Scoop can be installed by running the below command;

Set-ExecutionPolicy RemoteSigned -scope CurrentUser;iwr -useb get.scoop.sh | iex

Usefull scoop utilities;

scoop update *
scoop bucket add extras
scoop install sudo
scoop install 7zip
scoop install aria2
scoop install concfg
scoop install curl
scoop install dark
scoop install ffsend
scoop install git
scoop install http-downloader
scoop install innounp
scoop install openssh
scoop install openssl
scoop install ffsend
scoop install speedtest-cli
scoop install hosts-file-editor
scoop install treesize-free

Installing chocolately

Chocolately can be installed by running this command;

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));

Chocolately usefull apps

choco install vscode
choco install notepad++
choco install microsoft-windows-terminal

Windows Terminal

When chocolately if you have not already you can install Windows Terminal with the below;

choco install microsoft-windows-terminal

Windows $Profile

Powershell loads a .ps1 file when it is initialised and executes the commands found within the file. This file is called a profile file. The location of the profile can be found by typing the below command and the Powershell Prompt;

$profile

It is possible that after a fresh install the PS7 profile is not created. You can check if this file exists in PS7 with the below command, if the file does not exist the file is created.

(test-path($home  + '\Documents\Powershell\')) ? "Folder Already Exists" : (New-item -path ($home + '\Documents\Powershell\') -type "directory");
(test-path $profile ) ? "Profile Already Exists" : (New-item -path ($profile) -type "file");
ii $profile;

Windows $Profile Functions

Functions can be added to your powershell profile file found in the $profile path. I have added some useful functions and linked the location of them in this gitub below. Functions

Example

function Start-RDP ($computername)
{
    Start-Process "$env:windir\system32\mstsc.exe" -ArgumentList "/v:$computername"
}
Start-RDP server.lan

PSRemoting with SSH

See https://www.thomasmaurer.ch/2020/04/enable-powershell-ssh-remoting-in-powershell-7/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.