r/PowerShell • • Oct 25 '21

Game for learing Powershell?

Hey there

Is there a game I can learn about Powershell? Or any free courses? like https://flexboxfroggy.com/ . I want up my skills.

NazoN

134 Upvotes

30 comments sorted by

2

u/WorkJeff Oct 25 '21

Are you a student or a professional?

4

u/ItsNazoN Oct 25 '21

I am in a apprenticeship (switzerland)

3

u/False_Lingonberry919 May 16 '24

I hate the people that ask, never give an answer, and never respond when their query is answered. Like what difference does it make?

58

u/pandiculator Oct 25 '21

10

u/shankcraft Oct 25 '21

Came here to recommend this one since you're looking for something interactive and game-like. PSKoans is great for that.

25

u/PrivateSlumberparty Oct 25 '21

5

u/brainygeek Oct 26 '21

I remember doing a PowerShell class with the guys who made this while I was in the Army. They are great guys.

13

u/TryHardKenichi Oct 25 '21

I don't know about games, but there are definitely a lot of YouTube videos that you can watch. Also, look into "Learn PowerShell in a Month of Lunches" by Don Jones. There are companion videos on YouTube as well.

9

u/[deleted] Oct 25 '21

On the PowerShell subreddit here go to the "about", then select beginner resources and the very top thing is games and courses

11

u/spyingwind Oct 25 '21

Life.

On a serious note. Most of my learning of PowerShell is from using it for personal projects. Such as setting up a lab to play around with Active Directory in Hyper-V on my home PC. Even silly scripts that just send keys to a game, like "gg".

4

u/TryHardKenichi Oct 25 '21

Have you ever installed AD on Server Core?

3

u/Jaegernaut- Oct 26 '21

I did this in an unplanned DR scenario on a headless 2016 server with 0 prep, having never done an AD recovery before. Was fun.

1

u/TryHardKenichi Oct 26 '21

It's definitely a learning experience. I've done it a few times in my homelab over the years. I must admit, though, I kind of cheated and used SConfig each time. Also, once it's joined domain, RSAT to the rescue.

1

u/Jaegernaut- Oct 26 '21

The deployment itself isn't terrible - but a 20 deep peanut gallery all pulling in their own directions didn't help make it easy first time around lol

5

u/akaBrotherNature Oct 25 '21

Advent of Code will be starting in about a month. That's pretty fun, and good practice.

2

u/Phx86 Oct 25 '21 edited Oct 26 '21

Do you have access to an AD environment and rights to do things?

I find that structuring a framework is nice to have on hand and modifying it to do what I want. For example if I need to run a set of commands on a bunch of machines I use this.

 #Comment out the section based on how you are providing inputs

#Get servers from an OU
#$OU = 'OU="Some",OU="Other",DC=contoso,DC=local'
#$Servers = Get-ADComputer -filter * -SearchBase $OU | Select-object -ExpandProperty Name

#List of servers 
#$servers = @("Server1", "Server2", "Server3")

#Servers from a .csv
#$Servers = Import-Csv .\server.csv

Foreach ($Server in $Servers){
    Invoke-command -ComputerName $Server -scriptblock {
    Param($server, $servers)
        write-host $Server
        gpupdate /force
        Write-Host Policies updated
        w32tm /config /syncfromflags:DOMHIER /update
        net stop w32time
        net start w32time
        w32tm /resync
        } -argumentlist $server, $servers
    }

edit: not sure why I can't paste as a code block, but this is close enough that it is readable.

In this example I was undoing a GPO that set time on the servers and moving everything back to using domain hierarchy. I removed the policy on an OU, then ran the OU based input to grab all the servers in that OU and run a block of commands on them.

Replace everything inside the script block from the write-host to w32tm /resync and you can do whatever instead. Install an app, edit the registry, whatever... Obvious this would apply to workstations too if you wanted, just how I had the variables named for my use.

3

u/PMental Oct 25 '21

edit: not sure why I can't paste as a code block,

One blank line first, then all your code, each line indented 4 spaces, and you get a code block:

# Like
# this

3

u/BlackV Oct 25 '21

You used inline code, not code block would be my best guess

  • open your fav powershell editor

  • hightlight the code you want to copy

  • hit tab to indent it all (4 spaces)

  • copy it

  • paste here

it'll format it properly OR

<BLANKLINE>
<4 SPACES><CODELINE>
<4 SPACES><CODELINE>
    <4 SPACES><4 SPACES><CODELINE>
<4 SPACES><CODELINE>
<BLANKLINE>

3

u/Phx86 Oct 26 '21

I used block code at first and everything blew up huge. I'm guessing it was the leading # and tab indenting would have fixed it. Thanks

2

u/BlackV Oct 26 '21

Ah yeah the comments hash will do that

2

u/Lee_Dailey [grin] Oct 26 '21

howdy Phx86,

it looks like you used the New.Reddit Inline Code button. it's [sometimes] 5th from the left & looks like <c>.

there are a few problems with that ...

  • it's the wrong format [grin]
    the inline code format is for [gasp! arg!] code that is inline with regular text.

  • on Old.Reddit.com, inline code formatted text does NOT line wrap, nor does it side-scroll.

  • on New.Reddit it shows up in that nasty magenta text color

for long-ish single lines OR for multiline code, please, use the ...

Code
Block

... button. it's [sometimes] the 12th one from the left & looks like an uppercase C in the upper left corner of a square.

that will give you fully functional code formatting that works on both New.Reddit and Old.Reddit ... and aint that fugly magenta color. [grin]

take care,
lee

2

u/lil409 Oct 26 '21

I got into powershell because I was doing C# for a long time, it makes it easier when you know other .NET based languages like C# or VB, I guess you can also look at the Microsoft Docs and Youtube videos for a better understanding

1

u/nostril_spiders Oct 31 '21

/u/b00tleg you asked about this, i believe?

-9

u/wavyhairguy Oct 26 '21

powershell. ew

2

u/MrHaxx1 Oct 26 '21

3

u/Swarfega Oct 26 '21

Without even looking at their profile I bet they an avid Linux fan.

0

u/[deleted] Oct 25 '21

[deleted]

9

u/techerton Oct 25 '21

This is how I did it. Googled how to do menial tasks every time I saw an opportunity where I could use PowerShell. This includes adding/removing computers from domains, setting up/removing user accounts, automating software installs, setting up monitoring/alerting, etc. You can automate almost anything in Windows using PowerShell.

It was a pain and took longer at first, but the more I learned about the common commands, the easier it became. It led me to developing scripts that can let us do 20 billable hours worth of work in an 8-hour workday.

1

u/[deleted] Oct 26 '21

I'd agree. Different people learn differently, but for me I found it best to just start doing.

3

u/[deleted] Oct 26 '21

[removed] — view removed comment

1

u/adhaas85 Oct 26 '21

That is a great way to put it