I’ve been looking at some of the vCheck 5 code looking for possible code improvements. There are a few changes that I believe could simplify the script, but require PowerShell v2. One that comes to mind would be using Send-MailMessage instead of a custom function that sends mail using the .Net properties. In order to maintain backwards compatibility I have left this alone…until now! While looking over the PowerCLI 5 (build 435426) release notes I noticed the following heading:
Support for PowerShell 1.0 will be removed in the next PowerCLI release.
This is important to note — and also means that I will start using more PowerShell 2 going forward. The current build of vCheck I’m working on (5.45) will contain several improvements in the way output is addressed. I’m planning on moving all of export tasks into a function within the configuration section of the script and switching the mail function to Send-MailMessage. This will reduce the number of lines of code as the custom function can be removed and will also be easier for newer PowerShell users to understand.