powershell

Consolidate Checkpoint file with Transaction Log files folder

We had an independent review of all our Exchange servers and the consultants came back and pointed out that our Checkpoint log location was different than our log files. They wanted us to put the Checkpoint file in the same folder. I did this in 2 parts.

1. Grab all storage groups that currently had different values.

get-storagegroup | ?{$_.systemFolderPath -ne $_.LogFolderPath} | select server, name, logfolderpath, systemfolderpath | export -path c:\Checkpoint.csv

Quckie - Get Windows Service Pack Level

We had a cluster issue with one of our Exchange 2007 CCR clusters. It didn't successfully failover when the virtual server quit responding. On this, we noticed that this server was still running Windows 2008 SP1.

This quick script exports all the windows versions and service packs for all current Exchange servers in your environment.

$servers = Get-ExchangeServer

$report = @()
foreach ($S in $servers) {
        $colItems = get-wmiobject -class "Win32_OperatingSystem" -namespace "root\CIMV2" -computername $s.Name
        $report += $colItems | select Caption, CSName,CSDVersion
}

Recurse DL Parents

I am working on a project to add members to a series of distribution lists. These lists are nested into various parent lists, sometimes 2-3 layers deep. It's never been updated, but almost all these distribution groups are Mail-enabled Global Security groups. Powershell really, really wants to work with Universal groups. You can't just convert the current DL to Universal, it's parent needs to be Universal also.

The following function recurses a DL's parents and converts them all to Universal DLs using Quest's Set-QADGroup.

function Find-ParentDL ($dl) {

Quick DL Search - All DLs that a specific person can SEND To (AcceptMessagesOnlyFrom)

This uses the Powershell filter to limit the list of ALL DLs to only those locked down to individuals. It doesn't filter on lists that the client is a member of having permissions. I specifically was looking for mail enabled contacts having permissions on my DLs.

$AllDLs = Get-DistributionGroup -ResultSize unlimited -Filter {AcceptMessagesonlyFrom -like "*"}
$alldls | ?{$_.AcceptMessagesOnlyFrom -match "Woodford, Eric"} | select displayname

Returns the names of all DLs.

Create DLs from CSV

At my current employer, we are constantly bringing on new customers. As I detailed in my VBScript version, it's a fairly complex environment.

The attached Powershell script does the following:

  1. Read CSV file of distribution list properties. (Alias, displayname, email address, etc.)
  2. Check then create each new DL
  3. Populate secondary properties on each DL like, proxy addresses, Allowed Senders, Size limits, and members.

Import Remote IP Range into Exchange 2007 EDGE servers

We maintain an Exchange EDGE server on our perimeter as SMTP relay. Application servers can use this server to relay email out (to internal recipients or the Internet). To keep this server from being an open relay, we maintain a list of valid IP addresses that can relay through this server. To update the the relay, we run my script below to import the IPs. On our first attempt, we found that MS Edge 2007 - Receive Connectors have a limit on allowed RemoteIPRanges values. After approximately 1100 individual IPs, it would quit accepting any additional IP addresses. Unfortunately, we have over 1300 current application servers running currently.

Exchange 2007 Move-Mailbox Report

As we migrate our mailboxes over from Exchange 2003, to Exchange 2007, we've been asked numerous times for reports detailing the time/size of each mailbox moved. Lucky for us, Exchange does a wonderful job documenting the move (when you use move-mailbox to do so). Unfortunately for most humans, this data is in XML format. Readable, just not user friendly.

Hence, I created this nifty script, to read the XML files, then export a summary (in HTML and CSV format) of the moves. To get it running in your environment, you'll need to:

Exchange 2007 Email Address Policy - distribution lists & mailboxes

We are set to finish our migration of several email domains over to our Exchange 2007 environment. One of the last issues to migrate across is the Exchange 2003 Recipient Update Policies, into the Exchange 2007 Email Address Policies.

Our current e2k3 RUP is a fine-tuned LDAP query:

(mailnickname=*)
(|(extensionattribute3=EXAMPLE*)(department=EXAMPLE*))
(|(objectCategory=group)(&(objectCategory=person)(objectClass=user)))

Delete Contacts NOT found in CSV

We have been working to synchronize our GAL through non-technical means with another remote company. We don't actively have a connection to this other environment so sneaker-net is the solution.

I currently get a CSV from this company with the following columns.

  • Mode (A for Add, D for Delete, C for Change)
  • FirstName
  • LastName
  • DisplayName
  • EmailAddress

Get Summary of Outlook Versions connecting to Exchange 2007

Asked for a query to get a summary of the Outlook Clients that are connecting to our Exchange server. The following Code will run against all mailboxes in a specific OU, but removing the filter will get all mailboxes on an Exchange server.

Your final results will include a count of the client versions in your environment. As you can see, each of our CIO dept has a Blackberry device (hence 2 MAPI Outlook client versions) and is running Outlook 2003 SP3 (Google 11.0.8161).

For example:
Count Name
----- ----