Search for account by alias

Get-Mailbox -Identity * | Where-Object {$_.EmailAddresses -like '*address*'} | Format-List Identity, EmailAddresses


Powershell – Send Mail through O365

$cred = Get-Credential
$to = ""
$from = ""
$smtp = ""
$port = "587"
$body = "<p>This can be <bold>HTML formatted</bold> with a bit of creative tagging.</p>"
$subject = "Look! I can send mail from Powershell"
Send-MailMessage -SmtpServer $smtp -Port $port -UseSsl -Credential $cred -From $from -To $to -Subject $subject -Body $body -BodyAsHtml -Verbose

O365 Skype for Business – Import 3rd Party Conference Credentials

Connect to O365

$cred = Get-Credential
$session = NewCsOnlineSession -Credential $cred -Verbose
Import-PSSession $session

Next, assign the CSV containing the user list to a variable

$accts = Import-Csv "C:\temp\users.csv"

Loop through the accounts in the CSV file and assign the credentials to the users

foreach ($user in $accts) { Set-CsUserAcp -Identity $user.Acct -TollNumber $user.TollNumber -TollFreeNumbers $user.TollFreeNumber -ParticipantPasscode $user.Passcode -Domain "" -Name "PGi" -URL "" }

If you do not know your Domain or URL, compare with an existing assignment

$user = Get-CsUserAcp

Remove/Add Rights to Shared O365 Mailbox

Full access rights

Add-MailboxPermission -Identity -User -AccessRights FullAccess -InheritanceType All
Remove-MailboxPermission -Identity -User -AccessRights FullAccess -IneritanceType All

Send As

Add-RecipientPermission -Identity -AccessRights SendAs -Trustee
Remove-MailboxPermission -Identity -AcccessRights SendAs -Trustee

Send on Behalf

Set-Mailbox -Identity -GrantSendOnBehalfTo @{remove=""}
Set-Mailbox -Identity -GrantSendOnBehalfTo @{add=""}

Function to add all permissions for User to Shared Mailbox

function addperms ($sharedmb, $user)
Add-MailboxPermission -Identity $sharedmb -User $user -AccessRights FullAccess -InheritanceType All
Add-RecipientPermission -Identity $sharedmb -AccessRights SendAs -Trustee $user
Set-Mailbox -Identity $sharedmb -GrantSendOnBehalfTo @{add="$user"}}

Function to remove all permissions for User to Shared Mailbox

function remperms ($sharedmb, $user)
Remove-MailboxPermission -Identity $sharedmb -User $user -AccessRights FullAccess -InheritanceType All
Remove-RecipientPermission -Identity $sharedmb -AccessRights SendAs -Trustee $user
Set-Mailbox -Identity $sharedmb -GrantSendOnBehalfTo @{remove="$user"}}

Remove/Add Email Address O365

Connect to O365 Exchange Online

Then confirm that the user doesn’t already have the email address


Set-Mailbox -EmailAddresses @{add=""}

Review the assigned addresses

$userAcc = Get-Mailbox

$userAcc.EmailAddresses | fl

To remove an address

Set-Mailbox -EmailAddresses @{remove=""}