Scripts

SefaUtil GUI

If you have worked with Lync Enterprise voice then you have probably used Sefautil (secondary extension feature activation). A cmdline tool which allows you to configure several settings related to enterprise voice for example:

  • call forward
  • simultaneous ringing
  • call pickup (only Lync 2013)

A cmdline works OK but because you forget the parameters which you can use it maybe hard sometimes. To make this a lot easier I developed a wrapper around the tool: SefaUtil GUI.

SefaUtil GUI

The tool is based on a Powershell script and allows you to configure the same functionalities as the cmdline tool does only then via a GUI. The tool contains two tabs. The first tab Main contains all the functions. On the second tab Info you can find some diagnostic info such as the Lync Server version, the directory where Sefautil is located and logging information. The logging which is created can be exported by pressing a button so you can review what has changed.

Installation

The script needs to be placed on a machine where the Sefautil tool is installed. A detailed description of how to install Sefautil can be found on this page: Deploy the SEFAUtil tool.

Besides the tool you will need to install the Lync Core components.

In some cases it is necessary to change the executionpolicy for the script, more info can be found on this page: Using the Set-ExecutionPolicy Cmdlet.

You can start the tool like this: start-sefautil -pool poolfqdn

Download

Cleanup Shadow Redundancy Queues

Depending on your environment a Hub server will contain one of more shadow redundancy queues. You could clean them up by using the queue viewer but this can be a lot of work if you have multiple Hub servers in that case Powershell is the way to go.

The Cleanup_ShadowRedundancyQueue script verifies if there are shadow redundancy queues on a server with one of more messages in it. The script will removed messages from the queue that are at least one day old. You could of course change this option if you like.

The script uses one parameter server which is used to specify the name of the Hub Transport server you would like to check.

The script can be downloaded via the link below:

download

Creating backups from Exchange databases is recommended just like backing up your other data. When using Netapp storage you can use the Snapmanager for Exchange to perform the backups. This product makes it possible to create a backup of a database within a few minutes.

Snapmanager does use the scheduled task from Windows for the scheduling part. Creating the backup tasks can be performed by using a wizard which is available in the Snapmanager console. When you want to do this for a few databases this is a method you can use but when you need to backup a large amount of databases it might be handy to create the backup tasks via a script.

The script is developed using Powershell and uses a XML template. The reason for this is that it is not possible to create a scheduled task via Powershell using the Windows 2003 template. Because Snapmanager for Exchange has this as s requirement so it can display the task in the NetApp console the only solution is to use a XML.

Before starting the script it may be required to modify some of the parameters in the XML:

  • author, this field can be used to change the creater of the task
  • interval, can be used to change the intervals between backups, by default every 8 hour the task is started
  • command, the command which will run, you might need to change this depending on the location where Snapmanager is installed
  • workingdirectory, here the same is applicable as for command and might need to be changed when the Snapmanager installation directory is changed

The script can be used either by specifying the parameters of by using a CSV. Below are two examples of how you can use the script:

Create_BackupSchedule.ps1 -database MBDB01 -server MBS01 -starttime 05:00AM 

Creates a scheduled task on a server called MBS01 and backups the database MBDB01 starting
at 05:00 AM.

Create_BackupSchedule.ps1 -CSV c:\script\backups.csv

Creates backup schedules on the servers using a CSV as input.

The script can be downloaded via the link below:

download

Let’s cleanup the mess caused by iOS

21-2-2013: script has been updated due to a missing } which will cause the script to fail

You probably know about the iOS issue which had a great impact on Exchange environment. One environment might have had more issues then the other one and administrators may have taken actions via several actions.

Apple has released an update for iOS which should fix the issue, if it really is fixed is just a matter of waiting. Till now no negative messages have been posted on several sites so it looks like it is solved.

Cleanup proces

And now what to do? A lot of Exchange environment are polluted by the bug in iOS. Now the issue has been solved it’s time to cleanup all the mess.

To cleanup we first need to find out which mailboxes are really hit by the bug. To do this you can use the Powershell cmdlet Get-MailboxStatistics and use the select option with the parameters  Username, TotalItemSize, TotalDeletedItemSize, Items and DeletedItems.

Once you have found the mailboxes which are having the issue we will need to identify which item is causing the issue. To find the item you will need to use the Get-MailboxFolderStatistics cmdlet. Because the items are placed in the recoverableitems folder we will need to specify this as the folderscope. As last parameter we will need to use the analysis option which gives detailed information about the item. Using this cmdlet and parameters we will find the item which is most problematic item.

To cleanup the item you will need to use the search-mailbox cmdlet.

IOS6 cleanup script

As you have just discovered it can be a lot of work to cleanup the items. Because this maybe very hard in large environments I decided to create a script which finds the mailboxes, finds the item causing issues and optionally cleans up the item. The script will search per mailbox database. This because I have seen that it can cause a large amount of logging. The last one can have serious consequences for your storage, if the volume is almost full the databases will be dismounted automatically. Since this is not what we want it is very import to monitor the free space on the disk volumes when performing this process.

You can download the script via the Technet ScriptCenter of by using the link at the end of this blog.

In the current version the following functions are available:

  • search the specified database
  • create a report of the users which have a larger deleter item size then specified
  • create a report per user with the output of the analyses
  • automatically export the item to the specified mailbox and remove the item from the mailbox

But how to execute the script? Before doing this it is important to know which parameters you can use:

  • database, name of the database on which you want to perform the process (required)
  • minsize, minimum size of the deleted items (required)
  • topsubjectcounter, minimum value of how many times must the same item exist (only required if autoclean is used)
  • autoclean, performs a search, exports the item and removes the item (default false)
  • userreport, creates a list of users who are passing the configured threshold (default false)
  • targetmailbox, which mailbox may be used as target for the exported items (only required if autoclean is used)

For example: we want to search the database MBDB01 and want to know which mailboxes are having deleted items which are in total bigger then 1 GB.  Once we found those mailboxes we want to cleanup the item found during the analysis process only if it exists 1000 times or more. Besides this we want to get a report of which the mailboxes which will be cleaned up.

To do this execute the script like this:

.\IOS6.ps1 -database MBDB01 -minsize 1024 -topsubjectcount 1000 -autoclean $true -userreport $true

Disclaimer: This script should be used at your own risk. Using the autocleanup functionality
can cause data loss. Recommendation is to first test it in a test environment before using
it in your production environment.

During the cleanup process a large amount of logging can be created it is recommended to monitor your environment during this process.

If you’re missing things or you have a question about the script then please let me know.

download script

New version of fix-alias.ps1

During a migration you may encounter the issue that incorrect aliasses are used, for exampe spaces or incorrect characters in the alias. Microsoft has published a nice script fix-alias.ps1. There are some limitations when using this script. Because of this I modified the script a bit and added the following features:

  • option to provide multiple search criteria;
  • option to provide a replacement per criteria;
  • option to check and fix the alias of Public Folders;

If you have additional whishes please let me know by leaving a comment or by contacting me via the contactform.

download fix-alias.ps1 (original version)
download fix-aliasv20.ps1

Automate OWA IM Integration configuration

Since the release of Exchange 2010 Service Pack 1 the steps for configuring OCS/Lync IM integration for OWA has changed.

To simplify this proces I created a script which performs the following tasks:

  • check if the correct software and patches are installed;
  • configure the OWA virtual directory;
  • restart IIS;

The script will need to be executed from the CAS server and does only work for Exchange 2010 SP1. Besides the Exchange part don’t forget to configure the OCS/Lync side.

download prepare_owa_im.ps1 v1.0