Exchange 2007 –Report attributes in excel

Hi Readers,

I was analyzing the integration between the identity managemnt tool & exchange for one of the enviornment where mailboxes are not geeting auto deleted from idm. so I have got the list of ids that were disabled during last year. After that I have wriiten the below script to get the data out to excel so that I can compare.

##  Script ot read from text or csv file & export to csv ##
##  various exchange attributes for the list of users    ##
##  Author: Vikas Sukhija                                ##
##  Date:- 03/21/2012                                    ##
##  Description:- Csv or text file should be as below    ##
##  our enviornment cutom attribute contains employee id ##
###########################################################
## USR_LOGIN       ##
## 10000013       ##
## 29990900       ##
## 99000000        ##                                    
###########################################################
$data = import-csv $args[0]

# Create a collection to hold results (dynamic array)

$mbcombCollection = @()

# get all mailboxes so that looping occurs in memory

$mailbox = get-mailbox -resultsize unlimited

# loop thru the malboxes now

foreach ($i in $data)

{

$MBX = $mailbox | where {$_.CustomAttribute1 -eq $i.USR_LOGIN}

$MBXdisp = “” | select Name, ServerName, WhenChanged, HiddenFromAddressListsEnabled ,UserAccountControl,

ExchangeUserAccountControl, OrganizationalUnit

$MBXdisp.Name = $MBX.Name
$MBXdisp.ServerName = $MBX.ServerName
$MBXdisp.WhenChanged = $MBX.WhenChanged
$MBXdisp.HiddenFromAddressListsEnabled = $MBX.HiddenFromAddressListsEnabled
$MBXdisp.UserAccountControl = $MBX.UserAccountControl
$MBXdisp.ExchangeUserAccountControl = $MBX.ExchangeUserAccountControl
$MBXdisp.OrganizationalUnit = $MBX.OrganizationalUnit
$mbcombCollection += $MBXdisp
}

#export the collection to csv , change the path accordingly

$mbcombCollection | export-csv c:\idm\results\march2012.csv

####################################################################

You can customize it based on your enviornment.

Advertisements

One thought on “Exchange 2007 –Report attributes in excel

  1. Really good post. I just came on your blog and wanted to say that we have seriously really liked reading your web page posts. In any case I am going to be subscribing to your posts and I really hope you post again soon enough.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s