How did you learn to type-out & reason through scripting language?

h3110! I’m an auto-did-act learning how to USE and OPERATE computers like a computer science major would. Ok, here’s my “screed”: I never went to high school, and long story short → I need to learn how to read and reason through scripting language, programming-style structures and command syntax (with the goal of Systems/Network Admin). I’m currently reading books with words like, “beginner” in the title but inside the authors are using terminology, commands and coding I have never seen/heard. An excellent example is the book, “C Programming: Absolute Beginner’s Guide.” Also, many online searches have yielded no results for books that start at the v e r y beginning! I’m familiar with many words and basic CS concepts. I’m almost done going through “PowerShell in Depth”, 2nd ed., by JONES, HICKS & SIDDAWAY, picking out everything fundamental and basic.

Welcome to the forums :wave:

So even as folks with some experience, we constantly see terminology, commands, and code that we’ve never seen before. One of the best (and sometimes one of the most daunting) things about working in IT is that it’s not possible to know it all. In fact, things now progress so fast that it’s very difficult to know everything in even specific areas.

Honestly, focussing on programming in and of itself is not going to get to you to your goal of becoming a systems or network admin. Understanding some of the basic concepts such a loops, functions, strings, conditional statements etc. will help you write better scripts but the kind of things you’ll learn about on a CS programming course: abstraction, inheritence, coupling, cohesion, polymorphism etc. are not things that the average systems administrator is thinking about when scripting.

If your goal is to become a sysadmin or network admin (each different disciplines in their own right) I would consider looking at the learning paths of some of the big vendors. This will give you some idea of the careers available and the technical knowledge required to pursue them.

Whichever path you choose, learning is no substitute for experience. If you’re not already working in a junior role, you can gain some of that experience by building a homelab or making use of Azure or AWS (both offer free tiers) to play with real servers.



Thank you matt-bloomfield!

I will carefully go through those links. In the mean time, it appears you latched on to the least-important point of my post → how I can I understand & reason through this?"↓

Param ([string]$ComputerName=$env:COMPUTERNAME)
New-Variable -Name ADS_UF_DONT_EXPIRE_PASSWD -Value 0x10000 -Option Constant
$users=$server.children | where {$_.schemaclassname -eq "user"}
foreach ($user in $users) {  
   if ($user.userflags.value -band $ADS_UF_DONT_EXPIRE_PASSWD) {          
  else {
  New-Object -TypeName PSObject -Property @{

I can name a couple of these segments and some of the syntax . . . what I’m trying to get at is where did you all learn how to read this and reason through it? I doubt very much any Microsoft learning program is going to go that far back in CS knowledge.

[The block indentations didn’t get rendered in the post!]

You have to format it as code! :wink:

Although part 1 of PowerShell in Depth covers the fundamentals. The best beginner’s guide to PowerShell is Learn Windows PowerShell in a Month of Lunches

That book and learning how to use the PowerShell help system, together with writing your own code is what really helps when trying to understand other people’s code.

1 Like

i hope here are enough keywords to search. Most of it is in the official documentation

# The Parameter Block. You define your params here
Param (
    # A Param 'ComputerName' with a default value of the environment Var 
    # 'ComputerName'. The 'string' is to make sure the value is a string
    [string]$ComputerName = $env:COMPUTERNAME

# A new Variable. 'Constant' is to make sure you cannot change the value.
New-Variable -Name ADS_UF_DONT_EXPIRE_PASSWD -Value 0x10000 -Option Constant

# Another new Variable 'ADSI' is an accelerator for
# 'System.DirectoryServices.DirectoryEntry' and it's there to make sure the Value
# inside 'Servers' is of that type.
[ADSI]$server = "WinNT://$computername"

# The Result is assignet to 'users'. Another new Variable
$users = $server.children | Where-Object { $_.schemaclassname -eq 'user' }

foreach ($user in $users) {
    # -band stands for 'binary and'
    if ( $user.userflags.value -band $ADS_UF_DONT_EXPIRE_PASSWD ) {          
        $pwdNeverExpires = $True
    else {
        $pwdNeverExpires = $False
    # creates a new Object of type PSObject and drops it into the pipeline
    # the Parameter Property takes a hashtable.
    # I wouldn't do it this way
    New-Object -TypeName PSObject -Property @{
        Computername         = $
        Username             = $
        PasswordNeverExpires = $pwdNeverExpires

to the initial question. It’s just brute force. Either you dissect everything and google the heck out of it. Or you move on to the next code.
Read Code. Write Code. Read Code. Write Code.
And always ask “WHY?”, or “HOW?”. Way to many IT People stopped to ask that.

You issue is, “how do I read code other people write? the syntax is alien to me…

It’s rather easy, first and most core step in your example, is to learn about advanced functions because all of this also applies to scripts that are not functions:

about_Functions_CmdletBindingAttribute - PowerShell | Microsoft Docs

about_Functions_Advanced_Parameters - PowerShell | Microsoft Docs

about_Functions_Advanced_Methods - PowerShell | Microsoft Docs

Once you grasp those 3 links in detail with exercise, the only issue that remains while reading someones else code is code style.

Not everybody has same style, some people make it particularly hard to read, and to get around this you have to develop your own writing style first, because in doing so you’ll immediately differentiate “bad” syntax from language specific syntax.

Which means you can then focus on relevant (language syntax) rather than code style (someones else writing style)

I doubt very much any Microsoft learning program is going to go that far back in CS knowledge

I personally doubt any book is going to teach better than MS docs and various code samples online, but this is just personal preference which I recommend anyone to addopt.

For example long time ago, I started learning C++ with books, and later discovered I wasted a lot of time reading bad books which only helped me in writing bad code.

Later, drilling trough good code samples online helped more because I was learning from someone who is writing real world code rather than someone selling books for profit as their primary reason for writing.

Of course this is slightly harder way to learn, but there are benefits too, you only need to make sure to choose small samples and find documentation that goes straight to the point you want to learn.

Following link may help to develop your own writing style:

Introduction - PowerShell Practice and Style (

1 Like

Aww, @matt-bloomfield, that is a sublime aphorism!

Great resources, @metablaster; thanks for the inspiration, and the links!

And that is an excellent style guide. (But it’s been a bit embarrassing to see some of the recommendations … if you get my drift. :face_with_hand_over_mouth:)