From the course: PowerShell: Scripting for Server Administration

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Anatomy of a PowerShell script

Anatomy of a PowerShell script - Server Tutorial

From the course: PowerShell: Scripting for Server Administration

Start my 1-month free trial

Anatomy of a PowerShell script

- [Instructor] Compared to some programming and scripting languages, PowerShell is pretty tolerant of the way users enter their code. Still, there are some best practices that you should observe. PowerShell is not case sensitive for the most part. Sometimes, PowerShell Core needs to be for cross-platform support, and sometimes, object names may be case sensitive. But, for the most part, PowerShell doesn't care whether you use uppercase or lowercase letters. Also, PowerShell Core allows forward and backslashes interchangeably, even in the same expression. Lines in PowerShell scripts can be indented or not indented or even crammed onto the same line and often run just the same. But there are some rules that will ensure that your PowerShell script runs correctly, and, just importantly, these best practices will make your life much easier as you maintain your scripts and as you share and try to collaborate with others. There's a really nice style guide posted on GitHub. You can find it by…

Contents