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...