From the course: PowerShell: Functions for Advanced Automation
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Document functions
From the course: PowerShell: Functions for Advanced Automation
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.