Guest post by Shane Williford
Last week I was going through some tweet history from my European colleagues, and one particular tweet stood out to me by Alan Renouf. He mentioned that “if you are a system admin of any kind, you *should* be using this tool”. That tool being vCheck (see HERE for info, download, & video on how to use). At the time, I think I may have heard of it, but since I had a few free minutes, I thought I’d check it out to see what the buzz was about.
DISCLAIMER: The vCheck script is from Alan Renouf as well as several other contributers. Any troubles you may have running the script in and of itself, you will need to follow-up with Alan on his site so he can assist you.
After downloading vCheck, going through Alan’s video, and ‘tweaking’ things to make it work, I began to think…”can I separate these plugins out so I can have a more ‘niched’ output for what I want to run?”. Also, this script needs to be ‘configured’ upon initial run, and with all the plugins it has, entering information could take a while (albeit only on the first ‘run’ of the script). What my intentions were was to have a report for my Exchange, VMs, Hosts, vCenter, & virtualized Storage. I’m not really a scripter (one of my goals for this year is to become more proficient in PoSH/CLI), so after some frustrations in trying to do modifications myself, I tweeted out to the VMware/PoSH community for some guidance. ***PLUG: If you’re in Technology & you’re NOT part of some kind of technology community on Twitter, you’re severely hindering your potential career advancement and more importantly knowledge gaining. END PLUG***. I received some help from one of the more profound experts in the Powershell community, Jonathan Medd, as well as a virualization colleague Todd Scalzott, proficient in PoSH in his own right. Thinking others may want this vCheck Reporting segregation, I thought I would share with everyone what I did…fairly simplistic really (though took some testing to get it to work correctly). I don’t have a blog myself, so thanks to Chris Colotti for allowing me to borrow his blog for this brief post to share with everyone.
So enough of the pre-cursers…let’s get started!
So, first thing to do is obviously download the vCheck files. They come in a zip file. Place them somewhere on your workstation. They will look like this:
If you go into the Plugins folder, you can see all the Plugins that you would potentially need to answer questions for in the initial run through (too many for me to capture on 1 screenshot, but there are roughly 70).
Ok, so let me stop here and say this. You’ve downloaded the files, so before continuing with this post below, for the next ‘step’, I recommend going to Alan Renouf’s site (link above) and watch his “How To” video. It shows the basics of how to run the script. And, it’s only 5-6mins long. Continue reading when done…
Alright, so now to the nitty-gritty. So, to simply have different “groups” of reports, what I did was first make my group folders:
…then, within each folder, I coped all the files in Fig. 1 above EXCEPT the Plugins folder. I then created a Plugins folder then added the scripts I wanted to run for that particular ‘group’ (e.g. Exchange). Since I may have the potential of running the script as a Scheduled Task to have the report run weekly (or whatever you deem necessary for your environment), I renamed the .ps1 file to mirror the group I’m running it against so as not to confuse myself having several vCheck.ps1 files running a task (e.g. vCheckExchange.ps1 shown below):
Next, you need to add Plugins to your Plugins folder. NOTE: For Exchange, Alan has some Plugins available for download on his site. You can download them HERE. The Exchange Plugins download actually comes with all the vCheck files. You can keep them all or disregard (since you already copy/pasted them as suggested above) and just use the Plugins. Once downloaded, add the Exchange Plugins to your Plugins folder. You can change the name of the .ps1 file for intuitiveness or leave it as is. It’s your choice. If you choose to run this as a Scheduled Task in Windows (you can reference a post on Alan’s site on how to run a Scheduled Task), you can name the Task something descriptive and that should be sufficient. Now the moment of truth! Let’s run the script!
First, change to the directory where you created your ‘group’ folders, and more specifically, to the Exchange folder:
At the prompt, all you need to do is simply run your script by entering: .\vCheckExchange.ps1 (or whatever your .ps1 script name is in the Exchange folder). Your first run of the script, if you recall from above, will prompt you for some information (also, Alan’s video shares some of what is asked as well). Enter the information as you’re prompted. The information in brackets at the end of each question is the sample of what to put, OR it will be the default information if nothing is entered. After you enter information, press ENTER for the next question until completed. I will list a little of what I entered as guidance:
IP or Hostname of server to connect to: your Exchange server to run against, or your vCenter depending upon what ‘group’ you’re running
SMTP server: your Exchange server hostname
Email who will send the vCheck Report: your email address or address of user you have configured in your environment to send notifications from
Email who will receive the vCheck Report: your email address
Name of the report: your choice here
Display report in local browser: your choice; if you do, type $true; if not, type $false. I chose not to because it will be displayed directly in my email
Send email report…once completed: $true (but, your choice)
Add HTML attachment: your choice; not needed if answered $true to any of the other 2 above
You can then define the colors of the next 3 question items. I personally didn’t play with this and left them as default.
Keep default header
Drive details <=%: I wanted to know what drives/volumes on my Exchange server were running close to capacity. So, I defined what I wanted that to be (in percent) and entered my info here.
MAPI Latency >=%: your choice here. Best to use default (0) so you can see what it is.
Largest Mailbox: your choice here. This will show the largest mailbox sizes based off storage group (SG). The number you enter here will be the top 10 (default) or however many you specify
Per DB: I entered $True here because I wanted to see it on all 4 of my DBs (SGs), but your choice.
Top Dumpster Mailboxes: this displays mailboxes with the most Deleted Items. Your choice here (same as Largest Mailbox)
Per DB: same as above. Your choice though.
The remaining questions are either the same or self-explanatory (mostly). Alan explains some more info about other Plugins HERE and HERE. When you’ve answered the last question (“Enabled Plugins” for the Exchange ‘group’), the script will run and you will be sent an email and/or a web browser HTML page opened displaying the report, depending on how you answered the questions.
All subsequent runs will not prompt for information to be entered and will just run:
If you make a mistake in answering the questions, at this point, the only way I’ve found to re-do the script is to re-copy all the vCheck files to the directory. If I get an answer from Alan or Jonathan on how to make changes without having to go through the whole process again, I will post a comment, or submit an update to this post.
Ok, so the remaining ‘group’ folders will need some slightly more tweaking, but not much. And this is where I ran into troubles with my testing. So you should have all the vCheck wp-content/uploads/folders in each of the ‘group’ folders (VMs, vCenter, etc.), but the Plugins folder is empty. What you want to do is, from the original vCheck Plugins folder CTRL+Click select & cut/paste only the .ps1 Plugin files that pertain to what group you want them to be in. So, for example, in Fig. 2 above, you would CTRL+Click and cut the .ps1 items you want from that list, then paste them in the Plugins folder within the appropriate ‘group’ folder (VMs, etc.) you want. There are a couple files that need to be in every ‘group’ Plugins folder (except the Exchange folder). They are:
00 Connection Plugin for vCenter.ps1
VeryLastPlugin Used to Disconnect.ps1
…so the script can connect to your vCenter Server and then disconnect. Copy the above 2 files in all your ‘group’ Plugins folder, then add the individual .ps1 plugins you want. In Powershell, CD to the directory, then run the name of your vCheck .ps1 file (e.g. for my VM ‘group’, I will run .\vCheckVM.ps1). You will need to answer some of the same questions as in the Exchange plugin example above, as well as additional information pertaining to some of the Plugins. When complete, you will receive a similar email (or HTML page or attachment) as above, again depending on how you answered to receive the output. All subsequent runs will not need information added.
So, there you go. I thought someone else may benefit from wanting a little more segregation as I did so was willing to do this guest post for those who may be interested.