Video Screencast Help

VBScript -- EV Users Report - optionally set to email output.

Created: 03 Aug 2009 • Updated: 08 Sep 2009 | 1 comment
jprknight's picture
+5 5 Votes
Login to vote

Hi all,

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:

  1. RunMe.cmd - I setup scheduler to run this cmd which in turn runs the vbscript using cscript.
  2. SQLQuery.sql - The meat and potatoes to grab all the data.
  3. 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".

Jeremy.

Comments 1 CommentJump to latest comment

rikuluhti's picture

Nice work!!!

Script is working fine, but i didn´t get script show correct exhange server, it show all of servers,

User,02MS,28874,26897,123,1281,1404,10/04/2011 05:32:39 PM,06/18/2012 06:07:34 PM,Normal,
User,03MS,28874,26897,123,1281,1404,10/04/2011 05:32:39 PM,06/18/2012 06:07:34 PM,Normal,
User,04MS,28874,26897,123,1281,1404,10/04/2011 05:32:39 PM,06/18/2012 06:07:34 PM,Normal,
User,05MS,28874,26897,123,1281,1404,10/04/2011 05:32:39 PM,06/18/2012 06:07:34 PM,Normal,

Any idea how to get just correct exchange server in here?

0
Login to vote