Wednesday, August 31, 2011

How to reset user's Unified Messaging VoiceMail PIN via PowerShell

This one is so easy that I won't type too much :)

Set-UMMailboxPIN  -Identity USERNAME

Most used parameters:

  • Pin: use this parameter to manually set a new pin to the user
  • SendEmail: set this parameter to $false if you don't want the user to receive an e-mail with the new pin. The default value is $true, which means the user will receive an e-mail with the new pin and information about phone access numbers
  • NotifyEmail: specifies the email address that the automated email will be sent to
  • PinExpired: specifies whether the new Pin will be treated as expired, which means that the user should change it at the first log on.

More info:
Ler o texto inteiro ►

How to get mailbox permissions

Last article I've posted (How to grant/remove permissions on an Exchange 2007 mailbox) was about how to SET mailbox permissions, but another cool thing we can do with PowerShell is to GET them for that, you must use the cmdlet Get-MailboxPermission.

Get-MailboxPermission -Identity MAILBOX | Format-Table User, AccessRights, IsInherited

Most used parameters:
  • Identity: username or email address associated to the mailbox
  • User: use this parameter to check the rights an user has on the mailbox
  • Owner: use this parameter to check users who have owner rights on the mailbox

More info:
Ler o texto inteiro ►

How to grant/remove permissions on an Exchange 2007 mailbox

These almost-daily tasks are quite easy to perform via EMC, but infinitely easier through PowerShell...

Adds mailbox permissions:
Add-MailboxPermission -Identity MAILBOX -User USER -AccessRights FullAccess -InheritanceType All

Removes mailbox permissions:
Remove-MailboxPermission -Identity MAILBOX -User USER -AccessRight FullAccess -confirm:$false
Most used parameters:
  • Identity: the username or email address associated to the mailbox which you want to set the permissions
  • User: the username or email address associated to the user who will receive the permissions on the mailbox
  • InheritanceType: specify how far down the Active Directory object structure the “read” permissions are inherited (more info here)
  • AccessRights: the rights you want to grant to the user on the mailbox. Valid values are: 
    • FullAccess; 
    • SendAs; 
    • ExternalAccount; 
    • DeleteItem; 
    • ReadPermission; 
    • ChangePermission; 
    • ChangeOwner
  • Confirm: Specifies whether the command will pause and wait for your confirmation when removing an user's permissions. Set it as $True if you want the script to run without requesting confirmation.

UPDATE: See also the post How to get mailbox permissions about getting the permissions on a mailbox

More info:
Ler o texto inteiro ►

Tuesday, August 30, 2011

User mailbox has more than one primary SMTP address

Today I've got this issue, an user who couldn't receive e-mails from anyone. When I checked his mailbox, EMC showed me an error saying that his account had more than one primary SMTP address, opening user's properties. EMC didn't let me remove any of them since you can't remove the primary.

Error message: "There are multiple primary SMTP addresses. Please ensure there is only one primary address for each address type."

So the solution I've found was to remove the extra SMTP addresses from the attribute proxyAddress on user's Active Directory object. Leave only one of the addresses with prefix SMTP.

UPDATE: Use ADSIEdit.msc tool to remove the extra SMTP addresses. More information about ADSIEdit here.

Then EMC will let you add the secondary SMTP addresses back and they won't be marked as primary.
Ler o texto inteiro ►

How to check Exchange databases status via PowerShell

Run the cmdlet Get-MailboxDatabase to get information about the DB status. Use parameter -Identity to check the status of a single DB and -Server for all DBs in a server.


Check the status of a single DB

Get-MailboxDatabase -Identity DBNAME -Status | Format-Table Name, Mounted, BackupInProgress, OnlineMaintenanceInProgress

Check the status of all DBs in a Server
Get-MailboxDatabase -Server SERVERNAME -Status | Format-Table Name, Mounted, BackupInProgress, OnlineMaintenanceInProgress

* The -Status parameter specifies whether the script will get status information from the DB(s) or not. If not provided, the attributes Mounted, BackupInProgress and OnlineMaintenanceInProgress will return empty.


More info:
Get-MailboxDatabase cmdlet
Ler o texto inteiro ►

Monday, August 29, 2011

How to specify PowerShell session scope

As well as Exchange Management Console, Exchange Shell Console allows you to define the operations scope. You can choose for viewing and working either on the entire forest or on a single domain.

Exchange 2007
$AdminSessionADSettings.DefaultScope="domain1.contoso.com"
$AdminSessionADSettings.ViewEntireForest=$true


Exchange 2010
Set-AdServerSettings -RecipientViewRoot "domain2.contoso.com"
Set-AdServerSettings -ViewEntireForest $true

* when set to the entire forest, all settings changed will take longer than usual to replicate
Ler o texto inteiro ►

How to mount/dismount mailbox databases via PowerShell

For several times I had to dismount and re-mount all the mailbox databases from a server, and doing this via Exchange Management Console is way to slow, so I've researched a bit and found some commands to do this with PowerShell.

How to check Exchange databases status via PowerShell

In order to mount/dismount DBs, use Mount-Database and Dismount-Database respectively. Use Get-MailboxDatabase cmdlet with -Server parameter to fetch the DBs from a server and then the mount/dismount cmdlet.

Dismount a single DB
Dismount-Database -Identity DBNAME -Confirm:$False

Dismount all DBs of a server
Get-MailboxDatabase -Server SERVERNAME | Dismount-Database -Confirm:$False

Mount a single DB
Mount-Database -Identity DBNAME -Confirm:$False

Mount all DBs of a server
Get-MailboxDatabase -Server SERVERNAME | Mount-Database -Confirm:$False

Ler o texto inteiro ►
Related Posts Plugin for WordPress, Blogger...