SAPIEN Solutions

SAPIEN homepage
SAPIEN Software
PrimalScript script editor+ide
PrimalScope script debugger
Free Tools script utilities
SAPIEN Press tech books
ScriptingAnswers.com learn+share
ScriptingOutpost.com online store
Blog.Sapien.com official blog
Contact Us

 

Welcome to the ScriptVault, where ScriptingAnswers.com users share their administrative scripts.

Have you written a script that accomplishes some administrative task? Please share it! Just navigate to the appropriate category and click the "Contribute to this category" link!

You are here: Top > Email and Exchange

Contribute to this category


Sub-Categories

(no categories are available)

 

Scripts

CDO Mailer Contributed by Marcus L. Farmer
Very basic function in this script but gives a framework for the CDO messaging function.
CDONTS Mailer Contributed by Marcus L. Farmer
Script will prompt you for the recipient address as well as the from address.
EMailSize Contributed by Burt Johnson
Getting a list of mailbox sized in a large environment can become time consuming. You have to go into the ESM and expand every server, every Storage Group and every Mail Store. Then export each list to a file. Then combine all those files into one so you can sort away. This script will do it all with a click of the button. All you have to do is modify the line that reads ServerList = Array("server1", "server2", "server3") and put in your server names. The output is a CSV file that can be opened using Microsoft Excel and you're done. Enjoy!!
Exchange - associate an Exchange 2003 mailbox with a Windows NT 4.0 account - Automation Contributed by Tjerk Beke
This script gives an example on how to automate the following task in Exchange: - Create a new AD User - Create a mailbox for this user - Create the physical mailbox on the Exchange server (optional, not necessary for this script to work) - Add an external user with Send As permission to the AD object - Add an external user to the mailbox object with Read Permissions, Full Mailbox Access, and Associated External Account permissions. The main part of the script is copied from a very interesting script I found in the Exchange SDK; this script lets you create user accounts and create the mailboxes and even let you create the physical mailbox on the Exchange server (normally this mailbox is only created when the user logs on the first time). Then the security part is implemented based on a very interesting script I found in the book "Inside Active Directory" from Sakari Kouti (canbe found at http://www.kouti.com/samplescripts/CH11-36%20ADSI%20List%20ACEs%20-%20Long.vbs.txt). It scans all security acls that are placed on an object, and with this info, you simply define the new object's acl. So for example, if you need to add read access on an OU, you do it first manually, then launch this script, and with this info you know what security objecttype and accessmask you have to define. There's almost no difference in defining security for an AD object or for an Exchange object. Thanks to gadym for this info. I used a csv file as input for some parameters (newusers.csv), with the following format (it is a §-separated file): Alias§First Name§Last Name§CompanyName§Department§Telephone number§Exchange Server§First Storage Group§Mailbox Store§Domain Name§email address The rest of the parameters must be filled in in the script itself (lines 60->66).
Exchange Create new Storage Group Contributed by Jeff Hicks
Creates a new storage group in Exchange 2003
Exchange Mailbox report Contributed by Jeff Hicks
Reports on stats for an Exch2003 mailbox
Exchange Mailbox Store Report Contributed by Jeff Hicks
Reports stats for an Exch2003 mailbox store
Exchange New User Demo Contributed by Jeff Hicks
Demonstrates creating and mailbox-enabling a new user in AD.
Exchange Storage Group Report Contributed by Jeff Hicks
Reports stats for an Exch2003 storage group
Mailbox Size Report Contributed by hopsbarleyman
This HTA will prompt for authentication and then pass the credentials to a WMI query to enumerate mailboxes and their current sizes for all storage groups for each server listed in an array. Next the script will enumerate the properties for each users mailbox related to quotas via an ADO query using RootDSE. Finally, the output is nicely formatted into an Excel spreadsheet. I wrote this for some of the Exchange admins in my organizations which went over quite well as the only other way to get this info is boring text exports from System Manager.
MS Outlook 2003 auto-profiler Contributed by Zoran Marjanovic
1. Set the script in GPO as a logon script (CheckReg.vbs). 2. Create a prf file using MS Office 2003 Resource Kit tool "Custom Maintenance Wizard" (Outlook.prf). 3. Create a reg file (ModReg.reg) It will execute during logon and check if reg keys for MS Outlook 2003 user profile were created. If it finds the keys, it exits; if not, it runs the reg file used for importing the reg key with a path to a prf file. When user starts Outlook, Outlook finds the key in Registry containing the path to the prf file and configures Outlook. It imports the configuation when a user opens Outlook for the first time only.
Purge Mailboxes Contributed by Brian Kronberg
The script is based from TechNet script by Rene Meiger http://www.microsoft.com/technet/scriptcenter/csc/scripts/email/exchange/cscem010.mspx An interactive script that enumerates all disconnected mailboxes on the target server, lists individual and total size, and then offers the choice to purge them. Example Use: cscript //nologo PurgeMailboxes.vbs EXCHSVR01
Report Exchange Storage Limits Contributed by Burt Johnson
Ever want a quick way to report on who does not have the default Mail Storage limits? This script will do it. Just modify the LDAP string and possibey the "Page Size" for the oCommand1 Properties (I know there are ways to page thru the query, but I'm not using that) The output is a CSV file that can be opened in Excel and sorted to your hearts content.
Review Attachments For A Mailbox Contributed by Lael Black
The script will use XML to connect to an Exchange (2007?) server running WebDAV and loop through a specified mailbox finding any attachments larger than a specified size and within a set of dates. It will generate an email sending to the mailbox or to a specified user. The email links will take you to the individual email allowing for easy review/deletion.
Script for setting up Outlook profile Contributed by Peder Pedersen
A script for setting up Outlook profile when a user logs on for the first time. Needs a .prf file to set up the profile!! Checks to see if script has run before (only run once), Checks if its an XP machine, Checks if another profile already exists, Sets Username and Initials into Office. Some cleanup.
Send Email using Lotus Notes Client Contributed by Adrian Connor
Just pass the required info when you call the script ie address to send it to, subject, text body and patch to attachment. You will also need to point it to your mail database (check your notes client under location document and the mail tab). I have also turned this into a wsc so I can call this function from any script now that I have this working.(thanks to Dons webcast!)
Sending E-Mail From VBScript Contributed by donj
Ever write a script and wish it could easily send an e-mail? Perhaps e-mailing a report on the script's operations, or e-mailing an administrative alert? You can do it, and it's not that difficult. For example, here's a code snippet that will send an e-mail. Normally, that's all you'll need. If it isn't working, add the following lines before the objEmail.Send: objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "smarthost" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objEmail.Configuration.Fields.Update Usually you'll only need these lines if the IIS SMTP service isn't running and configured on the machine; these lines provide additional configuration information about how Windows needs to send the e-mail.