The amount of used space on a Hard Drive does not match the used space in Disk Management

Scenario:  We were getting alerted that the mount points (1 TB drives) on Exchange were getting low on free disk space.  During investigation, we noticed that there was an inconsistency with the size of the files and folders on the drive versus what Disk Management was showing.

Cause:  Shadow Copies must have been enabled at some point, and there was a shadow copy of another mount point on the mount point I was investigating.  (Open Disk Management –>Right click the drive and go to Properties –> Go to the Shadow Copies Tab and scroll down the list of Hard Drives)

Solution:

From a command prompt, enter the following:

Diskshadow

Delete Shadows All

When you look at the disk space now,  the shadow copy was removed and the space is now showing correctly.

When removing Mobile Devices from Exchange Mailboxes, you get the error message: DeviceId cannot contain hyphens.

Scenario:  When you attempt to remove a mobile device from a users mailbox, you receive the error below.

Error:  An unexpected error has occurred and a Watson dump is being generated: DeviceId cannot contain hyphens.  


Resolution: Remove the mobile device object via ADSI Edit.

1. Open ADSI Edit.
2. Under the Default Naming Context, navigate to the user object of the mailbox that has the mobile device.
3. Expand that user object, and click on the CN=ExchangeActiveSyncDevices.
4. Delete the Mobile Device for this user.

Time your Powershell Commands

Task:  You want to measure your Powershell commands so you can time your commands for efficiency. In the example below, I want to time how fast my results are returned for finding all Mailboxes in our organization.

Resolution:   Select from #Start to #End and copy and paste it all into PowerShell. Make sure you paste it all at once.  It will execute the start and end time variables and then subtract it.  It will then display the $total in these various units of measure; TotalMilliseconds, TotalSeconds, TotalMinutes, TotalHours, TotalDays, and Ticks.

#Start
$Start = Get-Date
Get-Mailbox -resultsize unlimited
$End = Get-Date
$total = $End-$Start
$total
#End

Retrieve all mailboxes assigned to a specific ActiveSyncMailboxPolicy

Task: Retrieve all mailboxes assigned to a specific ActiveSyncMailboxPolicy.  The ActiveSyncMailboxPolicy we are searching for is labeled “VIP”.

Run the following:

Get-CASMailbox -ResultSize unlimited | Where ActiveSyncMailboxPolicy -like “VIP” | Select SamAccountName, DisplayName,ActivesyncMailboxPolicy,ServerName | Export-csv C:VIP_EASPolicy.csv

Get all messages from all transport servers by a specific sender, starting on a specific day

Get all messages from all transport servers by a specific sender, starting on a specific day and export to CSV

Use this one-liner:

Get-TransportServer | Get-MessageTrackingLog -sender:test@test.com -start 7/15/2014 -resultsize unlimited | export-csv c:export.csv

Configuring Message rules for a shared Mailbox

Configuring message rules for a shared mailbox

Scenario: How do I access a shared mailbox and change a rule.  I do have admin rights and full access to this mailbox but when I do a file > open> and try to change the rules, it reverts back to my primary mailbox rules.

Note: Exchange 2010 users cannot modify rules for mailboxes in Exchange 2013, and vice versa

There are several methods to get this to work:

Method 1: Outlook 2010 or Outlook 2013

Configuring Message rules for a shared Mailbox/Service Mailbox

If you are using Outlook 2010 or Outlook 2013 and either have been granted Full Access permissions to the mailbox or have been provided separate credentials for it, then you can also configure this shared mailbox as an additional Exchange account or add it as a secondary mailbox of your own.

How to add an additional mailbox in Outlook 2010:

http://www.groovypost.com/howto/microsoft/add-a-second-additional-mailbox-in-outlook-2010/

How to add an additional mailbox in Outlook 2013

http://www.groovypost.com/howto/add-additional-mailbox-in-outlook-2013/

Once the mailbox has been added, select its Inbox folder and add the rule as you would normally do for your own mailbox.

Method 2: Outlook Web App

When you have been granted Full Access permissions, then you can log on with your own username and password and click on your own name in the top-right corner to get to the option of opening another mailbox.

If you haven’t been granted Full Access permissions but do have separate log on credentials for the additional mailbox, you can use that to log on.

Once logged in, you can create a message rule in the following way:

    For OWA 2013:
    Gears icon (right side of your name)-> Options-> Organize email

    For OWA 2010:
    Options (below your name)-> Create an Inbox Rule…
 

Delegate Installation of Exchange 2013

Delegate Installation of Exchange 2013 Server

Exchange Server 2013 lets you delegate the installation of Exchange servers to people who aren’t members of the Exchange 2013 Organization Management role group.

Notes: Only a member of organization role group can provision a server. Members of delegated setup can install Cumulative updates. Uninstallation of Exchange requires Org role group membership

step 1: There is a built in group for delegating setup of pre-provisioned servers, named the delegated setup role group. Add the installer to this role group. This allows the installer to install provisioned servers

Step 2: If you’re running Setup on the computer that’s being provisioned, run the following command:Setup.exe /NewProvisionedServer /IAcceptExchangeServerLicenseTerms

If you’re running Setup on another computer, run the following command:Setup.exe /NewProvisionedServer:<ComputerName> /IAcceptExchangeServerLicenseTerms

Delegate Installation of Exchange 2010 Server

Exchange Server 2010 allows an administrator to provision a new Exchange server and then delegate the actual setup of that server to another account

Notes: Only a member of organization role group can provision a server. Members of delegated setup can install Cumulative updates and rollups. Uninstallation of Exchange requires Org role group membership

step 1: There is a built in group for delegating setup of pre-provisioned servers, named the delegated setup role group. Add the installer to this role group. This allows the installer to install provisioned servers

Step 2: If you’re running Setup on the computer that’s being provisioned, run the following command:Setup.exe /NewProvisionedServer

If you’re running Setup on another computer, run the following command:Setup.exe /NewProvisionedServer:<ComputerName>

To make sure the server was properly provisioned for Exchange, you can do the following:

Go to Start > Administrative Tools, and then open Active Directory Users and Computers.

Select Microsoft Exchange Security Groups, double-click Exchange Servers, and then select the Members tab.

On the Members tab, check to see if the server you just provisioned is listed as a member of the security group.

If your server is listed as a member of the Exchange Servers security group, it was properly provisioned. Someone who’s a member of the Delegated Setup role group can now install Exchange on that server.

Add a user as the manager of a distribution group without removing existing managers via Exchange PowerShell.

Scenario:  Add a user as the manager of a distribution group without removing existing managers via Exchange PowerShell. If you were to use the Set-DistributionGroup command with the -managedby switch, it would remove the existing managers and set the managers you specified in the switch.  To add the user jdoe1 as a manager and not remove the existing managers from the distribution group ‘HQ-All Employees’, run the following PowerShell commands below.

$Group = Get-DistributionGroup “HQ-All Employees”
$Managers = $Group.ManagedBy
$User = Get-User  jdoe1
$Managers += $User 
Set-DistributionGroup “HQ-All Employees” -Managedby $Managers -BypassSecurityGroupManagerCheck

Excel Magic: If you have an Excel sheet full of groups in Column A and wish to add jdoe1 as the manager to each of those groups, copy the Excel formula below and drag it down for the entire list of groups. The value of each cell will create the Powershell command that you will need for each group.  Copy the cells (the cell values) and Paste it into Exchange PowerShell.  Each command is separated by a ; so the 5 PowerShell commands needed will fit into one Excel Cell and fit on one PowerShell line for each group.

=”$Group= Get-distributiongroup “””&A2&”””; $Managers= $grp.managedby; $User=Get-User jdoe1;$Managers+=$User;Set-DistributionGroup “””&A2&””” -managedby $Managers -BypassSecurityGroupManagerCheck”

A user receives ‘Something went wrong Sorry, we can’t get that information right now. Please try again later. If the problem continues contact your helpdesk’ error message when accessing OWA.

Scenario:  A new mailbox is provisioned and the user is receiving the following error when accessing their mailbox via OWA:

😦something went wrong

Sorry, we can’t get that information right now. Please try again later. If the problem continues, contact your helpdesk.

All normal mail protocols such as OWA and ECP were enabled by default.

Resolution:  I performed a search against the email address for that mailbox and came across two mailboxes that had the same email address  (get-mailbox  jdoe@domain.com). I removed this email alias from the user who was not using it.  The user experiencing the problem could now login to OWA.

Script to Purge IIS Logs on Servers

Scenario:  Some applications, such as IIS, will create daily logs on your server. These IIS logs can be big in size and will not automatically purge off.  The script below will purge all but 7 days worth of IIS logs for each server listed in the $servers variable.

PowerShell Script (PurgeIISLogs.ps1)

$servers = “MBX01″,”MBX02”

$servers | %{ 

dir $_c$inetpublogslogfiles -recurse |  Where { ((get-date)-$_.LastWriteTime).days -gt 5 } | Remove-Item -Force

}

To schedule this script to run as a daily task, setup a second script (a batch script) that calls the Powershell script and executes it. The batch script is below.

Batch Script (PurgeIISLogs.bat)

%SystemRoot%system32WindowsPowerShellv1.0powershell.exe -NoProfile -ExecutionPolicy Bypass -Command “& ‘c:TASKPurgeIISLogs.ps1′”