Archive for August, 2015

PowerShell & Exchange

August 10, 2015

A few handy PowerShell commands I just don’t use often enough to remember:

Change a users password

Set-MsolUserPassword -UserPrincipalName -NewPassword Password1 -ForceChangePassword $false

Hide a user from the address book

Set-Mailbox -Identity username  -HiddenFromAddressListsEnabled $true

Add Rights to a Public Folder

Add-PublicFolderClientPermission -Identity “\folder name” -AccessRights Editor -User username

Add an Address to an Account

set-Mailbox username -EmailAddress @{add=“”}

Did it work?

get-Mailbox username | fl EmailAddresses


What is the user currently allowing?

get-MailboxJunkEmailConfiguration -identity username | select -expandproperty TrustedSendersAndDomains

Add something to WhiteList

set-MailboxJunkEmailConfiguration -identity username -TrustedSendersAndDomains @{Add=””}

Block a sender for a particular user

$Temp = Get-MailboxJunkEmailConfiguration -Identity username
$Temp.BlockedSendersAndDomains += “”,””
Set-MailboxJunkEmailConfiguration -Identity username -BlockedSendersAndDomains $Temp.BlockedSendersAndDomains

Or an easier way. . .
Set-MailboxJunkEmailConfiguration -Identity username -BlockedSendersAndDomains @{Add=””}

Count and Delete Calendar Items

Search-Mailbox –identity username –SearchQuery kind:meetings –EstimateResultOnly
Search-Mailbox –identity username –SearchQuery kind:meetings –DeleteContent

Calendar Permissions
Of course these would work with any folder and yes, I could teach the user how to do this themselves, but they do it less frequently than I do; this is just easier.

List the current permissions on the Calendar

get-mailboxfolderpermission -Identity username:\calendar

Add permissions
(use set-mailboxfolderpermissions to change)

add-mailboxfolderpermission -Identity username:\calendar -user otheruser -accessrights Editor

Delete/remove Permissions

remove-mailboxfolderpermission -Identity username:\calendar -user otheruser -confirm:$false