Monthly Archives: August 2014

Viewing Delegates with Exchange 2010 and Powershell

When meeting requests are being delivered to the wrong people, it normally means that someone has added another user as a delegate in Outlook, or given the wrong permissions to the delegate. To find out which users have delegates using Powershell from the server can help identify these users. From the link (new window): http://gallery.technet.microsoft.com/office/Delegates-Report-for-e4cc3246/view/Discussions#content we can see a one liner that will provide this information, however we can modify it slightly for different needs:

Running the command as is:

Get-Mailbox -ResultSize unlimited | Get-CalendarProcessing | where { $_.ResourceDelegates -ne “” } | Select-Object identity,@{Name=’ResourceDelegates’;Expression={[string]::join(“,”, ($_.ResourceDelegates))}} | Export-csv -Path c:tempResourceDelegates.csv

Will produce a CSV file in c:temp with column A as the Mailbox, column B, C, etc as the delegates, ready for importing into Excel. The @ symbol and everything after in the {} brackets is an array of the delegates.

You can get the results on a single mailbox (%IDENTITY% is the mailbox alias) by using:

Get-CalendarProcessing -identity %IDENTITY% | select-object ResourceDelegates

In this example, both Lucas Knorr and Nicholas Deane are delegates of Beau Kenny’s mailbox.

To get a list of all delegates for all mailboxes, you can use:

Get-Mailbox | Get-CalendarProcessing | Select-Object Identity, ResourceDelegates

However this has drawbacks, such as including mailboxes that don’t have delegates, and column width limitations. To resolve this, use:

Get-Mailbox | Get-CalendarProcessing | Where {$_.ResourceDelegates –ne “”} | Select-Object Identity, ResourceDelegates | Format-List

Excel 2010 using If and Conditional Formatting

Often while I am using Excel I have the need to use conditional formatting and if statements to organise data.  I always end up having to lookup how to do these actions, so I am writing them down here so I can find them easier.

An If statement in Excel has the following format:
IF(logical_text,[value_if_true],[value_if_false])
Given the following dataset:

We want to make the Column B have values of ‘READ’ or ‘WRITE’, depending on the value of column A.  If the value of the cell in column A is 0, the value of the cell in column B should be ‘READ’, a value of 1 in column A should have a value of ‘WRITE’ in column B.
To do this, we enter the following formula in cell B1:
=if(A1=0,”READ”,”WRITE”)
This is evaluated as: if the cell in A1=0, then the value is “READ”, else the value is “WRITE’”

To use  conditional formatting based on the value of another cell, imagine the following dataset:

We want to highlight the values in column B with RED if the value in column A is 0, and GREEN if the value is 1.
To do this, select Conditional Formatting, and select New Rule…

Select Use a formula to determine which cells to format, and enter the formula:
=a1=0
Set the format fill to red.

Click OK
Select Conditional Formatting and select Manage Rules…

Enter the Applies to and drag the selection to the range of the cells you wish to have this rule apply to.

Click Apply.
You can see the rule take effect.

To create the second rule to highlight in green, follow the same steps above, but use the formula:
=a1=1
and set the format fill to green

You can also use rules to highlight based on the text or string value of a cell.  EG: to highlight a cell if the value in another cell is “RW”, use the formula =a1=”RW”

Auditing file permissions with Powershell and accesschk.exe

I needed to determine the level of access specific users had.  I used a mix of Powershell and accesschk.exe (You can download from here (new window): http://technet.microsoft.com/en-us/sysinternals/bb664922)
Using the command from powershell:
.accesschk.exe –s “%DOMAIN%%USER%” %DIRECTORYTOCHECK% | Out-File %LOGFILE%
eg: to find out which files in the f:qld folder that the user SALESjohnsa has access to, logging to f:itaccessjohnsa.txt
.accesschk.exe –s “SALESJohnsa” f:qld | Out-File f:itaccessjohnsa.txt
You can also restrict this to listing the directories that can be accessed, by using the –d switch:
.accesschk.exe –s –d “SALESJohnsa” f:qld | Out-File f:itaccessjohnsa.txt

Setup Exchange 2010 Full Access Permissions

To give a user full access to another users mailbox in Exchange 2010, follow these steps:
Open the Exchange Management Console


Click Yes on the User Account Control Dialog if it appears

On the left hand side of the screen, navigate to Microsoft Exchange –> Microsoft Exchange On-Premises –> Recipient Configuration


Select Mailbox





Right Click on the user’s mailbox you wish to give access to, and select Manage Full Access Permission…


Click Add…


Select the Name of the user you wish to give access to, and click OK


Click Manage


Click Finish


You can also accomplish this by using Powershell.  In this example, Andrew will be given full access to Craig’s mailbox:

Add-MailboxPermission -Identity Craig -User Andrew -AccessRights FullAccess

You can also use groups.  In the example below, the group called Sales Users will be given full access to Craig’s mailbox:

Add-MailboxPermission -Identity Craig -User “Sales Users” -AccessRights FullAccess

To do bulk changes, you can follow the post here (new window):  http://anonit.blogspot.com.au/2014/07/changing-exchange-2010-mailbox.html