VBScript -- EV Users Report - optionally set to email output.
Credit has to go to Wayne Humprey for the inital SQL script which generates the user report.
I have just taken this one step further by creating a VBScript which will run the SQL script, then take the output and write it to a .csv file, then optionally this .csv file can be emailed.
I know in my organisation the team who can produce the most reports for managers rules, so this keeps people upstairs happy in Excel for hours :)
There are three files:
- RunMe.cmd - I setup scheduler to run this cmd which in turn runs the vbscript using cscript.
- SQLQuery.sql - The meat and potatoes to grab all the data.
- EV-Users-Report.vbs - The part which I created. Writes all the info to a timestamped .csv file and then optionally emails off the data.
Note: You will need to configure SQL file to reflect your EV databases. You will also need to configure the vbs file to reflect your email environment if this is what you require.
Email is turned on or off via the EmailEnabled variable; which is on by default. So the script will error out until you either set your email options (such as to & from address, and smtp server) or set EmailEnabled to 0.
The VBScript itself reads your directory server from the registry so this script will only run on an EV server. Although if you wanted to run the script from another server it should be quite easy to comment out that section with ' then add a line thus: DirectoryServer = "Your_Directory_Server".