GithubHelp home page GithubHelp logo

sharinas / powershell-fundamentals Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 36 KB

My collection of PowerShell cheatsheets, code samples, notes and resources.

PowerShell 100.00%
powershell windows-powershell powershell-fundamentals learning-powershell ps-commands aws

powershell-fundamentals's Introduction

PowerShell-Fundamentals

My collection of cheatsheets, code, notes and resources created while learning PowerShell

[[TOC]]

Index

Types of PowerShell

Powershell core – newer. Does not come with Windows by default. Can do nearly all the same stuff. Allows us to run commands on multiple platforms, unlike Powershell. Based on .netcore. Downloadable from GitHub. Can be run on Windows, Linux and MacOS. The future way of working with PS. An open source project. Only has a subset of Windows PS commands, but it’s a large subset. To open in computer, can type “pwsh"

Windows Powershell ISE – integrated scripting engine. The original built in editor for editing PS scripts. Comes installed by default.

Windows Powershell - most popular. Built into Windows. Only on windows; can’t install or run on mac or linux. Based on the .net standard, using the .net framework that PS is built on. Development has stopped for Windows Powershell (no further updates, except for security stuff).

Objects

PowerShell treats all data as objects.

Can be both text based and objects based.

PS commands use objects as their output, which is helpful, since objects properties and methods.

Used with pipes, the object that is outputted from one command is passed to the next command.

Get-Service|Select-Object name,starttype,servicetype|more

Command Syntax

Verb-Noun – all commands should be formated this way.

Parameters – used to pass info into the command. All prefixed with a “-”.

Positional Parameters

It expects in the first position that the "name" parameter will appear. This means that you can shorten commands for named parameters.

Instead of:

get-service -name p*

You can simply write:

get-service p*

Or, if you're also using Aliases:

gsv p*

Aliases

Helpful when testing small stuff. Avoid using in your scripts.

Search For A Command to Do Something

Example: Say, you're looking for runtime dynamic data, particularly a runtime performance counter.

Do a general search for commands that have the word counter in them, with wildcards around the word to indicate that the word can be at the beginning, middle or end of a command.

get-command *counter*

check help for the one that looks promising.

help get-counter

Look at the Syntax section for flags to use.

Try the main command

MORE CONTENT PENDING

Loops

While Loops

See PowerShell file titled while-loops.ps1 for examples.

Resources

powershell-fundamentals's People

Contributors

sharinas avatar

Watchers

 avatar  avatar

Forkers

toivoparnpuu

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.