Exchange 2007 Compount Architecture
You can download the copy from the below mentioned link
Exchange 2007 Compount Architecture
You can download the copy from the below mentioned link
All Mailbox Settings are stored in Active directory and once you make changes like Storage Quota limits etc it will take 2 hours to reflect for the user. This is because Exchange Cache active directory information every 2 hours. This is known has Mailbox Cache Age Limit. We can change registry settings to reflect the Mailbox settings (Storage) ASAP. Recommended modification to keep Mailbox Cache Age limit to 1 hour from 2 hours and its also not recommended to limit less then 20 Min
Details description of the registery settings is describited in the below mentioned site
http://technet.microsoft.com/en-us/library/bb684892.aspx
By default deleted mailbox retention policy is 30 days and after that deleted mailboxes will be disconnected state for next 30 before its actually gets deleted off the store
Below powershell to get the list of all the users on the specific Exchange server who disconnected mailbox older than 10 days, you can modify the days based on your requirement into the variable $disconnectedUsers
$DisconnectedUsers = Get-MailboxStatistics -Server <servername> | where-object { $_.DisconnectDate -ne $null } | ?{$_.DisconnectDate -lt (get-date).AddDays(-10)} | Select DisplayName,Database,MailboxGuid
Below command will get the users from variable $DisconnectedUsers one by one in the for loop and delete the same
$DisconnectedUsers | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
Powershell to create the Mass mailboxes in Exchange 2007 orginisation from CSV input file. Below is the CSV file format which need to have the following header and details in the below mentioned format
Csv Format
Firstname, Lastname,Aliasname,Database,OUPath
Krishna, kumar,krishnakumar,server\storagegroup\store,Users
Below is the powershell script to create the mass mailbox by reading the csv file and and create the mailbox. First it take the password as input and reads the csv file and create the mailbox with the information in the csv file
$Password=Read-Host “Enter Password” -AsSecureString
Import-CSV C:\CreateNewmailbox.csv |
foreach {
$userprincipalname = $_.Firstname + “.” + $_.Lastname + “@domain.com”
new-mailbox -name $_.name -alias $_.alias -FirstName $_.Firstname -LastName $_.Lastname -userPrincipalName $userprincipalname -database $_.Database -OrganizationalUnit $_.OUpath -Password $Password
}
Powershell to create the list of contacts from the given CSV files in the specified
$csv = Import-Csv “C:\Contacts.csv”
foreach($line in $csv)
{
New-MailContact -Name $line.DisplayName -ExternalEmailAddress $line.EmailAddress -OrganizationalUnit “Contacts” -Alias $line.Alias
}
Loadbalance of the Exchange Database is very important. We need to make sure that database is not dumped with all the mailbox and once database gets big then move maiboxes to the other database. We can automate this process buy make the script to find the smallest size of the database in the Exchange orginisation and create the mailbox in the same
$MailboxSvr = Get-MailboxServer | select name
$i = 0
foreach($svr in $mailboxsvr)
{
$db = Get-MailboxDatabase -Server $svr.Name
foreach($database in $db)
{
$Server = $database.Server.Name
$Db = $database.Identity
$edbfilepath = $database.EdbFilePath
$path = “`\`\” + $Server + “`\” + $edbfilepath.DriveName.Remove(1) + “$”+ $edbfilepath.PathName.Remove(0,2)
$Dbsize = get-item $path |select-object length
$K = $Server + ” ” + $Db + ” ” + $Dbsize.Length
if ($i -eq 0 )
{
$edbsize = $Dbsize.Length
}
If ($edbsize -gt $Dbsize.Length)
{
$edbsize = $Dbsize.Length
$sdb = $database.Identity
}
$i = 1
}
}
Write-output “ENTER THE FOLLOWING DETAILS”
$DName = Read-Host “User Diplay Name ”
$FName = Read-Host “First Name ”
$LName = Read-Host “Last Name ”
$passwd = Read-Host “Password ” -asSecureString
$PrincipalName = $FName + “.” + $LName + “@domain.com”
$Aliasname = $FName + “.” + $LName
New-Mailbox -Name $DName -Database $sdb -UserPrincipalName $PrincipalName -FirstName $FName -LastName $LName -Alias $Aliasname -Password $passwd -ResetPasswordOnNextLogon $true -SamAccountName $Aliasname
You can get the complete copy of the code in the below link file
Exchange Powershell to get list of Database and their last fullbackup time in Exchange 2007 servers
Get-MailboxDatabase -status | Select Servername,Identity,Lastfullbackup
Powershell command to get the list of mailbox which was never logged in
Get-MailboxStatistics | where {$_.Lastlogontime -eq $null } | Select displayName
Many times we will have requirement to execute Exchange Comlets and Active Directory(Active Roles) cmdlets on a singlewindow. As we cannot execute exchange cmdlets in AD shell and vice versa. We have to add snap in to the powershell to execute both cmdlets on a single shell.
1. Need to make sure both Exchange managelent tools and Quest Active role management shell for active directory has been isntalled on the machine
2. Create C:\ExchangeAd.ps1 file with following lines in it
Add-PSSnapin Quest.ActiveRoles.ADManagement
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
3. Open Windows powershell and type C:\exchangead.ps1 to add snapin to the windowspowershell. You can execute both the commands on the single shell
4. Or you can Cretae a bat file which contain follwing line and place into your desktop. For Easy accability
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -noexit -command C:\ExchangeAd.ps1
5. You can also execute Quest snapin into Exchange powershell or Exchange snapin into Activeroles shell to execute other commands on the same window.