Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PowerCLI Essentials

You're reading from   PowerCLI Essentials Simplify and automate server administration tasks with PowerCLI

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher Packt
ISBN-13 9781785881770
Length 194 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Chris Halverson Chris Halverson
Author Profile Icon Chris Halverson
Chris Halverson
Arrow right icon
View More author details
Toc

Quality control, consistency, and simplification

Although this is not the most exciting of sections, quality control, verification testing, and error handling are the most important areas of any script. Without testing and error handling, attempting to explain that the PoSH text in red is okay and the errors shown are normal, over and over, makes the perception of the script, for lack of a better word, bad. This section discusses the flow of the script, preparing what is expected and planning for what is not.

Revisiting documentation

Going back to the documentation is extremely important. Highlighting, as it is written, that the #Gathers information to be used for building the VM later on function is good but writing that Function X is for #decision processing and that the VMName Record is #the name of the VM is better.

Now, our function is given as follows:

<#This function gets a list of VMs and searches for the VMs with a V in the name#>
Function Gather-VmsWithAV ($VMlist) {
  #Loop...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime