From the course: PowerShell: Functions for Advanced Automation

Unlock the full course today

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

Document functions

Document functions

From the course: PowerShell: Functions for Advanced Automation

Start my 1-month free trial

Document functions

- [Instructor] In this course, I've created a few short PowerShell scripts that contain various functions and I've described them as we've gone along. Now, it's not normal to have an audible description of a function playing every time you look at it, so you're going to want to comment your code. This is done using a couple of different methods. The first is by adding a single comment, where it would be helpful to describe why a line or block of code is necessary. Don't add obvious comments. It doesn't do any good to put a comment before the line assigning the date to a variable just to say, assigning the current date to a variable. That much should be obvious. It would be more helpful to add a comment before the data command let's it gather IP addresses. Something that tells someone looking at this script, that these cmdlets are going to collect a list of IP addresses, as a single string, and break them up into an array, possibly, define a block of codes saying we're collecting lots…

Contents