August 22

How to use Powershell to Export All Distribution Groups and Members to CSV

Create a temp fold at c:\ called c:\temp and run the following script


$Groups = Get-DistributionGroup
$Groups | ForEach-Object {
$group = $_.Name
$members = ''
Get-DistributionGroupMember $group | ForEach-Object {
        If($members) {
              $members=$members + ";" + $_.Name
           } Else {
              $members=$_.Name
           }
  }
New-Object -TypeName PSObject -Property @{
      GroupName = $group
      Members = $members
     }
} | Export-CSV "C:\temp\Distribution-Group-and-Members.csv" -NoTypeInformation -Encoding UTF8
December 19

Office 365: Hide a user from the GAL when using Azure AD Connect

Error message: 

The operation on mailbox “John” failed because it’s out of the current user’s write scope. The action
‘Set-Mailbox’, ‘HiddenFromAddressListsEnabled’, can’t be performed on the object ‘John’ because the object
is being synchronized from your on-premises organization. This action should be performed on the object in your
on-premises organization.

How to fix it:

  1. Open Active Directory Users & Computers.
  2. Enable Advanced Features by clicking View > Advanced Features.
  3. Set the msExchHideFromAddressLists attribute to True

4. set the mailNickname field.

 

 

October 20

How to Add Calendar Permissions in Office 365 or Exchange Server Using PowerShell

Check the current calendar permissions:

Get-MailboxFolderPermission -Identity user1@domain.com:\calendar

In order to grant user2 the permission to view and edit user1 calendar items, run the following command:

Add-MailboxFolderPermission -Identity user1@domain.com:\calendar -user user2@domain.com -AccessRights Editor

When managing calendar and Outlook folder permissions, you can use the following predefined permissions level roles:

  • Owner — gives full control of the mailbox folder: read, create, modify, and delete all items and folders. Also, this role allows to manage item’s permissions;
  • PublishingEditor — read, create, modify, and delete items/subfolders (all permissions, except the right to change permissions);
  • Editor — read, create, modify, and delete items (can’t create subfolders);
  • PublishingAuthor — create, and read all items/subfolders. You can modify and delete only items you create;
  • Author — create and read items. Edit and delete own items;
  • NonEditingAuthor — full read access, and create items. You can delete only your own items;
  • Reviewer — read folder items only;
  • Contributor — create items and folders (can’t read items);
  • AvailabilityOnly — read Free/Busy info from the calendar;
  • LimitedDetails — view availability data with calendar item subject and location;
  • None — no permissions to access folders and files.