November 11, 2009
When user leaves orginization administrators make sure that account is disabled and its marked for deletion. Delection can happen once in 15 days or 1 month. We may need to perform series of steps for disabling the account
eg. Disable Account, Move Object to Disabled Account OU, Hiding from GAL, removing Group members, 0 ing send and receive limits.
Below powershell script helps to perform the same. It uses both Exchange commands and Quest Active roles command lets. We need to add the snapin to execute the code.
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
Add-PSSnapin Quest.ActiveRoles.ADManagement
$AName = Read-Host “Enter User Alias name for Disable”
$AName | out-file -filePath E:\users.txt
foreach ($user in (get-content E:\users.txt)){(get-qaduser $user).memberof | Get-QADGroup | where {$_.name -ne “domain users”} | Remove-QADGroupMember -member $user}
Move-QADObject $user -NewParentContainer “domain.com/Disabled Accounts”
Disable-QADUser $user
Set-Mailbox $user -HiddenFromAddressListsEnabled $true -UseDatabaseQuotaDefaults:$False -issuewarningQuota 0MB -ProhibitSendQuota 0MB -ProhibitSendReceive 0MB
Below location has copy of the code
http://powershell.com/cs/members/smtpport25.wordpress/files/DisableUserAccounts.ps1.aspx
Leave a Comment » |
Active Directory, Exchange 2007, Powershell | Tagged: disable user accounts |
Permalink
Posted by Krishna
November 11, 2009
Normally when ever user leaves orginization his account will be disabled and Hidden from GAL. Some times chances that users are just disabled and not hidden from GAL. Where is the script which pulls out all the mailbox which are in Accountdisabled state and it hides the account from the GAL
Get-Mailbox -ResultSize unlimited |Where{($_.UserAccountControl -like “AccountDisabled*”)} | set-mailbox -HiddenFromAddressListsEnabled $true
Leave a Comment » |
Exchange 2007, Powershell | Tagged: Disabled accounts |
Permalink
Posted by Krishna
November 6, 2009
DFS Resplication service is only supported in Windows 2008 Domain Functional Level. If Active Directory is running in windows 2000 or windows 2003 then FRS is used to replicate Sysvole. If Domain Funcation is 2008 the all the domain controller in the domain must be windows 20080
There lots of advantages in using DFS Replication over FRS to replicate SysVolume. Below link has details description on the DFSR Migration and advantages list over FRS
http://blogs.technet.com/filecab/archive/2008/02/08/sysvol-migration-series-part-1-introduction-to-the-sysvol-migration-process.aspx
http://blogs.technet.com/filecab/archive/2008/02/14/sysvol-migration-series-part-2-dfsrmig-exe-the-sysvol-migration-tool.aspx
http://blogs.technet.com/filecab/archive/2008/03/05/sysvol-migration-series-part-3-migrating-to-the-prepared-state.aspx
http://blogs.technet.com/filecab/archive/2008/03/17/sysvol-migration-series-part-4-migrating-to-the-redirected-state.aspx
http://blogs.technet.com/filecab/archive/2008/03/19/sysvol-migration-series-part-5-migrating-to-the-eliminated-state.aspx
Leave a Comment » |
Active Directory, Windows 2008 | Tagged: DFSR, Migration, Windows 2008 |
Permalink
Posted by Krishna
October 29, 2009
Widows 2008 R2 comes with powershell v2 by default. and added with 76 new Ad cmdlets and Ad provders
New-ADOrganizationalUnit -Name “OUname” -ProtectedFromAccidentalDeletion $true
This command creates new OU under the root. If we wanted created OU in specific path then we have to provide the pat. Below is the example of the same
New-ADOrganizationalUnit -Name “OUname” -Path “OU=AllUsers,dc=grayson,dc=test” -ProtectedFromAccidentalDeletion $true
-ProtectedformAccidentDeletion $true help to protect the OU getting accidentially deleted.
Get-ADOrganizationalUnit
Helps to get the details of the required OU
Set-ADOrganizationalUnit
Helps to modify the OU
Remove-ADOrganizationalUnit
Helps to remove the required OU
Leave a Comment » |
Powershell, Windows 2008 | Tagged: Active Directory, new-adorganizationunit, powershell v2 |
Permalink
Posted by Krishna
October 28, 2009
Powershell to send email with delivery notification enabled. Once mail is delivered to the recipient mailbox and delivery notification mail will be sent to the sender mailbox. Below powershell help you to atchive the same
$msg = new-object Net.Mail.MailMessage
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.Headers.Add(“Disposition-Notification-To”, “from@domainname.com”)
$msg.DeliveryNotificationOptions = “OnSuccess”
$msg.From = “from@domainname.com”
$msg.To.Add(”to@domainname.com”)
$msg.Subject = “Make the Delivery Recipt Work Please”
$msg.Body = “In a perfect world this email will generate a delivery receipt”
$msg.Attachments.Add($att)
$smtp.Send($msg)
Leave a Comment » |
Exchange 2007, Powershell | Tagged: delivery notification, Exchange 2007, Powershell, Send mail |
Permalink
Posted by Krishna
October 15, 2009
The managed folder assistant is a Microsoft Exchange Mailbox Assistant that creates managed folders in users’ mailboxes and applies managed content settings to them. When the managed folder assistant is running, it processes all of the mailboxes on a server. If the managed folder assistant does not finish processing the mailboxes on the server during the time that you have scheduled, it automatically resumes processing where it left off the next time it runs. There is one managed folder assistant for each server
Get-ExchangeServer | Where { $_.AdminDisplayVersion.ToString().SubString(0, 10) -eq “Version 8.” `
-and $_.ServerRole -eq “Mailbox” } |
ForEach { Set-MailboxServer -Identity $_.Identity `
-ManagedFolderAssistantSchedule “Sun.1:00 AM-Sun.3:00 AM”, `
“Mon.1:00 AM-Mon.3:00 AM”, “Tue.1:00 AM-Tue.3:00 AM”, `
“Wed.1:00 AM-Wed.3:00 AM”, “Thu.1:00 AM-Thu.3:00 AM”, `
“Fri.1:00 AM-Fri.3:00 AM”, “Sat.1:00 AM-Sat.3:00 AM” }
http://technet.microsoft.com/en-us/library/bb123958.aspx
Leave a Comment » |
Exchange 2007 | Tagged: Exchange 2007, managedfolderassistant, Powershell, schedule |
Permalink
Posted by Krishna
October 14, 2009
SMTP Protocol logs are not enabled by default. In Both Exchange 2003 and Exchange 2007 SMTP Protocol logs need to be manually enabled.
In Exchange 2003 SMTP protocol logging is enabled on the SMTP Virtual Servers

Please download log parser from following link
http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en
Below log parser command help you to get list of servers connecting to Exchange 2003 server through SMTP
logparser “Select cs-username,count (*) as Hits from N:\ex0910.log GROUP BY cs-username ORDER BY Hits Desc” -o:DATAGRID
Below is the output it provides the list of server name and number of hits from that specific servers

Below mentioned article describes on how to enabled smtp protocol logging on Exchange 2007 and log files path
http://smtpport25.wordpress.com/2009/10/
Below command helps you to get the list of servers connect to the exchange server for sending emails
logparser “select REVERSEDNS(EXTRACT_PREFIX(remote-endpoint,0,’:')) as RemoteSendingHost, count(*) as Hits from RECV*.log group by RemoteSending Host order by Hits DESC” -i:CSV -nSkipLines:4 -o:DATAGRID
related articles
http://msexchangeteam.com/archive/2007/09/12/446982.aspx
http://msexchangeteam.com/archive/2007/11/12/447515.aspx
http://msexchangeteam.com/archive/2007/11/28/447598.aspx
http://linuxlore.blogspot.com/2006/11/howto-use-microsofts-logparser-to.html
Leave a Comment » |
Exchange 2003, Exchange 2007, Powershell |
Permalink
Posted by Krishna
October 12, 2009
Exchange Protocol Logging is not Enabled by Default in Exchange 2007. We have to enable the logging if required. Below powershell commands help you to enable the
Set-SendConnector “Send Connector Name” -ProtocolLoggingLevel verbose
Set-ReceiveConnector “Connector Name” -ProtocolLoggingLevel verbose
You can also enable the connector through Exchange Management Console.
EMC -> Exchange Orginization -> Hub Transport Servers -> Send connectors (tab) -> Right click on the required connector properties -> select Verbose

Location of STMP Logs in the below mentioned location
\Exchange Server\TransportRoles\Logs\ProtocolLog\SmtpReceive
\Exchange Server\TransportRoles\Logs\ProtocolLog\SmtpSend
Leave a Comment » |
Exchange 2007, Powershell |
Permalink
Posted by Krishna