Monday, November 14, 2011

Exchange 2010 Adding New-Mailbox

- Install PowerShell 2.0 (Can be install on Windows XP SP2 / SP3)
- Open PowerShell then type "notepad $profile" without quotes.
- Notepad will come up named with "Microsoft.PowerShell_Profile.ps1
- Copy and paste following line

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://your-cas-server.mmx.com/PowerShell/ -Authentication Kerberos
Import-PSSession $s

- Save and exit the notepad.
- Open PowerShell
- Now you're ready to use PS.
-------------------------------------------------------------------------------------
(1) New-Mailbox -UserPrincipalName robertbg@mmx.com -Alias robertbg -Database 'Development Team' -Name 'Robert Gemmell' -OrganizationalUnit Development -Password (ConvertTo-SecureString -AsPlainText Pa55w0rd -Force) -FirstName Robert -LastName Gemmell -DisplayName 'Robert Gemmell'

(2) Set-Mailbox “robertbg” -MaxSendSize 20Mb -MaxReceiveSize 20Mb

(3) Set-CASMailbox robertbg -ActiveSyncEnabled:$false -OWAEnabled:$true -PopEnabled:$false -ImapEnabled:$false -MapiEnabled:$true

(4) Get-Service -name MSExchangeSA | restart-service (Type on Mailbox Server's EMS)

OR

(4) restart-Service -InputObject (get-Service -ComputerName ygn-mb1-2k8 -Name MSExchangeSA) (from remote client's powershell)

(5) Update-FileDistributionService -Identity your-cas-server -Type OAB (Type on CAS Server's EMS or remote client's powershell)

(6) Test-Mailflow -TargetEmailAddress 'robertbg@mmx.com' <- an email will received with message "This is a test message from Test-Mailflow"

-------------------------------------------------------------------------------------

Set-Mailbox -Identity dave -UseDatabaseQuotaDefaults $false -ProhibitSendReceiveQuota 2GB -IssueWarningQuota 1gb

Disable-Mailbox -Identity dave -Confirm:$false (Disable Account and mark dbase to delete)
-------------------------------------------------------------------------------------
Mail Enable for AD Users
------------------------
Enable-Mailbox dave -Database Development Team

Get-User -RecipientTypeDetails dave | Enable-Mailbox -Database Development Team
-------------------------------------------------------------------------------------
Exchange Servers Monitoring Commands
------------------------------------

Get-ExchangeServer | Test-ServiceHealth <- Check all the Exchange Services on all the exchange servers.

Test-ServiceHealth | Select-Object -Expand ServicesNotRunning | Start-Service

get-service *exch* <- check all the exchange services on local server

Get-Service *exch* | Where-Object {$_.Status -eq 'Running'} <- only running services

Get-ExchangeServer | ForEach-Object {Get-Service *exch* -ComputerName $_.Name | Where-Object {$_.Status -eq 'Running'}} <- check all the running services on servers

Get-Service MSExchangeAB -ComputerName ygn-cas-2k8 | fl * <- look detail on MSExchangeAB Service

Test-ServiceHealth | Select-Object -ExpandProperty ServicesNotRunning | Start-Service

(Start Services if not running)

Get-EventLog -list

Get-EventLog -LogName Application -Source *exch* -EntryType Error <- Only errors

Get-WmiObject Win32_LogicalDisk -Filter "DriveType='3'" | select @{n="Drive";e={$_.DeviceId}},@{n="Size";e={[math]::Round($_.Size/1gb,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1gb,2)}} <- check disk space on local server.

No comments:

Quote of the Day