Replace Job Title Of All Users In AD With Their Description via PowerShell

This one saved me a lot of work. We had a customer who had used their Description field for job titles due to the way their signature manager was configured. When we migrated them to Office 365 we had to get these moved into the Job Title field for Exclaimer to pull from. The below attributes can be amended to any AD attribute.

I use Foreach loops with scripts like these to prevent the script from taking an age to run and also reduce memory usage. I have found doing these without such loops can cause PowerShell to hang and white out.

$Users = Get-ADUser -Filter { Description -like ‘*’ } -SearchBase “DC=contoso,DC=local” -Properties *

 Foreach ($User in $Users)

 {

 Write-Host Setting $User.DisplayName Job Title to $User.Description

 Set-ADObject -Identity $User.DistinguishedName -Replace @{ Title = $User.Description }

 }

 Write-Host Done Thanks PCQuickTips.Net!

Tagged : / / / /

Assign Office 365 Calendar Permissions via PowerShell

Using the below example you can easily grant access to a user mailbox or shared mailbox calendar.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session -DisableNameChecking

Add-MailboxFolderPermission -Identity userwhoownscalendar@domain.com:\calendar -user userwhoneedsaccess@domain.com -AccessRights Editor

For more information on the Access Rights and what they do please see below:

The following individual permissions are available:

  • CreateItems: The user can create items within the specified folder.
  • CreateSubfolders: The user can create subfolders in the specified folder.
  • DeleteAllItems: The user can delete all items in the specified folder.
  • DeleteOwnedItems: The user can only delete items that they created from the specified folder.
  • EditAllItems: The user can edit all items in the specified folder.
  • EditOwnedItems: The user can only edit items that they created in the specified folder.
  • FolderContact: The user is the contact for the specified public folder.
  • FolderOwner: The user is the owner of the specified folder. The user can view the folder, move the folder and create subfolders. The user can’t read items, edit items, delete items or create items.
  • FolderVisible: The user can view the specified folder, but can’t read or edit items within the specified public folder.
  • ReadItems: The user can read items within the specified folder.

The roles that are available, along with the permissions that they assign, are described in the following list:

  • Author: CreateItems, DeleteOwnedItems, EditOwnedItems, FolderVisible, ReadItems
  • Contributor: CreateItems, FolderVisible
  • Editor: CreateItems, DeleteAllItems, DeleteOwnedItems, EditAllItems, EditOwnedItems, FolderVisible, ReadItems
  • None: FolderVisible
  • NonEditingAuthor: CreateItems, FolderVisible, ReadItems
  • Owner: CreateItems, CreateSubfolders, DeleteAllItems, DeleteOwnedItems, EditAllItems, EditOwnedItems, FolderContact, FolderOwner, FolderVisible, ReadItems
  • PublishingEditor: CreateItems, CreateSubfolders, DeleteAllItems, DeleteOwnedItems, EditAllItems, EditOwnedItems, FolderVisible, ReadItems
  • PublishingAuthor: CreateItems, CreateSubfolders, DeleteOwnedItems, EditOwnedItems, FolderVisible, ReadItems
  • Reviewer: FolderVisible, ReadItems

The following roles apply specifically to calendar folders:

  • AvailabilityOnly: View only availability data
  • LimitedDetails: View availability data with subject and location
Tagged : / / /

Connecting to Office 365 Exchange Online via PowerShell

Very simple set of lines to connect to Office 365’s Exchange Online management in PowerShell. Once connected using the below you can then start running commands such as Get-Mailbox etc.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session -DisableNameChecking

Tagged : / /

List All Office 365 Mailboxes with Forwards via PowerShell

This is a really simple PowerShell script which will list all mailboxes on Office 365 with Forwards configured.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session -DisableNameChecking

Get-Mailbox | Where {($_.ForwardingSMTPAddress -ne $null) -or ($_.ForwardingAddress -ne $null)} | Select Name, ForwardingSMTPAddress, ForwardingAddress, DeliverToMailboxAndForward

Tagged : / / /