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 : / / / /

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 : / / /