Pages

Showing posts with label BackEnd. Show all posts
Showing posts with label BackEnd. Show all posts

Tuesday, January 7, 2014

Quick Mailbox Size Report

Every once in awhile, some department wants a mailbox size report for all of their users. There are a number of easy ways to do this, but sometimes the easiest ways are the slowest. For example:

get-mailbox | get-mailboxstatistics | select displayname, totalItemSize | export-csv "CSV File"

This works all-and-good until they want additional information, like department, or office! Since this additional information is not stored in the mailbox object, but the user object, you need to meld a get-user with your get-mailboxstatistics. This can easily turn your quick little process into a massive, eight hour query pulling data.

This script:

  1. Specify an OU or Distribution Group, and it will read all the members. 
  2. Read mailbox name, total item size, Office, current size, if using db quotas, issue warning quota, prohibit send quota, when the mailbox was created, last logon and database currently resides on.
  3. Output to CSV report.
  4. Attach it to an email to multiple recipients. 
  5. In email message body, break down the current db limits applied to all dbs in the report. "If UseDatabaseDefaults = True, see the message body for that size limit"

Thursday, January 2, 2014

Get Mount Point Info for Specific Server

There comes a time when I want to scan a server for all the mount points on a server. This function can be added to a script to generate two slightly different reports. First, stand-alone it will quickly return a report of all the mount points on a server. Second, if you run it with the '-detailed' switch, it will return the capacity, used and free space on each. The Detailed process takes considerably longer as it reads each file in that mount point.

Name          : D:\Databases\Mailbox-DB03\
FileSize      : 178617132724
CapacityinGB  : 931.36
FreeSpaceinGB : 764.85
UsedSpaceinGB : 166.51
FreePercent   : 82

The script will return an object containing the info, so the values can be used again.

$ServerMPInfo = get-MountPointInfo -servername "MailboxServer1" -detailed
$LowSpace = $ServerMPInfo | ?{$_.FreePercent -lt 10}

Monday, December 30, 2013

Process ActiveSync Enabled Mailboxes

As an email service provider for a large number of different companies, we need to be able to adapt to their needs. One of those needs was to have larger control over which of their employees can use an ActiveSync device. This meant that we had to lock down a large number of the mailboxes that do not get access. My solution was this script. To run this script you'll need: Exchange Management Tools and Quest ARS Powershell cmdlets.

What this script does: 
  1. Find all ActiveSync enabled mailboxes. I use an AD Directory Searcher method, so reading the values on 100,000 mailboxes only takes a few minutes, not hours.
  2. Reads an "Exchange ActiveSync Opt-in" group, containing groups and/or mailboxes. 
  3. Disables all mailboxes not in the Opt-In group. Enable all mailboxes in Opt-In group.
  4. Look at nested groups in Exchange ActiveSync Opt-in, compare names to ActiveSync Mailbox Policies in Organization, if matches, apply policy to all mailboxes in group. 

Expand CIDR Notation in Powershell

This is a repost of code from somewhere else. Running the script when you feed it a CIDR notation IP address will return the last entry requested.

For Example:

EXPANDCIDR "10.0.0.1/24"
10.0.0.255

Friday, December 27, 2013

Report-DAGAPDistribution.ps1

Running through the Exchange 2010 Server Role Requirements Calculator, I manage 3 copies of each database across 6 nodes of a dag. This has helped me distribute databases across all 6 nodes and not leave myself open in case of a disaster. Using my script, I can 1) see if all my existing DBs are correctly set for their activation preference and 2) see what activation options are still open for new DBs.

Tuesday, December 24, 2013

Find Unused Mount Points for Exchange 2010 DBs

Our Exchange 2010 environment has matured enough that I am now working on deleting and moving databases around between the various DAGs. In the coming year, we're even talking about expanding out to a DR site at another data center. With that, I am constantly looking for free drives on our DAS that can be used to provision databases on. Unfortunately there are a number of times that it appears all 25 drives are used, even though only 18 databases reside on the server.

This script compares the existing mounted volumes on a server with the existing databases. It returns the volume names for each of them that don't have a match.

Friday, December 20, 2013

ericwoodford.com reborn

It's been a few weeks, and I miss my old blog site. Here are a few things, I've been working on..

Quickly create an array of strings.
I use this when I've been given a list of something (smtp addresses, contact names, etc.) and need to search my servers for them. I cut and paste the code below into a Posh window, then paste in the data.

$s=@();do {$r=Read-Host "+";if($r -ne ""){$s+=$r.trim()}} while ($r -ne "")

Copy and paste from the source (html page, script run, email). When done, hit Enter for a blank line and now I can run my script against this list.