Powershell to get the members of DL and Sub DL and find the unique members
Category Archives: Exchange 2007
Powershell to pull Application Event logs with Event Id 1221
Application Event ID 1221 gives the details of the white space on the Exchange Database. With the amount of white space we can determine if we wanted to do a defrag on the store or not. Below powershell helps you to pull all the application events with id 1221 from last 2 days
$2DaysAgo = [DateTime]::Now.AddDays(-2)
$Events = Get-Eventlog Application | Where {($2DaysAgo -le $_.TimeWritten)} | ?{$_.eventid -eq “1221”}
$Events
Powershell to get the Home Directory Path
If we wanted to find Home Directory Path of the users in the Orginization then below commands helps you to pull the data
Get-QADUser | select DisplayName,Email,HomeDirectory | Export-Csv c:\HomeDirectory.csv
Command to get the Home Directory for the given list of users and export the result to CSV
get-content C:\users.txt | select DisplayName,Email,HomeDirectory | Export-Csv c:\HomeDirectory.csv
Powershell to set AD user password to never Expire
Below powershell command to set AD user to password never expires
Set-QADUser -Identity “domain\account” -ObjectAttributes @{useraccountcontrol=65536}
If you have list of users then you can put the file into the txt file and use powershell to set all the required user to password never expires
get-content “c:\users.txt” | Set-QADUser -ObjectAttributes @{useraccountcontrol=65536}
BITPro User Group Meet on 22-Aug-2009
There is a small presentation on Exchange 2007 HA and DR by myself (Krishna kumar) and Windows 2008 R2 VDI Over view by MR Ravikanth at Bangalore Microsoft Co-orporation , Signature Building
http://bitpro-fbevent.eventbrite.com/
Kindly register yourself and please attend the same
Microsoft Exchange Server User Monitor
Microsoft Exchange Server User Monitor is a tool which helps administrator to analyse REAL TIME Individual users utilization and details like outlook version, IP address, CPU Time, Average Latency, Bytes in and Bytes out etc from the perticular Exchange Server.
This tool supports Versions of Exchange link Exchange 2000, Exchange 2003 and Exchange 2007
VBscript to Check Schema has been updated on Domain Controllers
To Introduce new Windows 2008 Additional domain controller we have to forest and domain. As part of the forest preparation we run the commaind adprep /Forestprep. Its recommended to run this command on the Schema Master Server
http://technet.microsoft.com/en-us/library/cc753437(WS.10).aspx
Below VBscript will check on all the DCs for Schema update on the servername which are given in the file serverlist. Script result will confirm if schema is updated successful or failed on the servers.
Dim objShell
set objShell = wscript.createObject(“wscript.shell”)
Set filesys = CreateObject(“Scripting.FileSystemObject”)
set filetxt1 = filesys.OpenTextFile(“C:\serverlist.txt”,1)
do Until filetxt1.AtEndOfStream
Servername = filetxt1.Readline
servername = trim(Servername)
iReturn = objShell.Run(“CMD /C psexec.exe \\” & servername & ” schupgr > log.txt”, , True)
Set filesys = CreateObject(“Scripting.FileSystemObject”)
set filetxt = filesys.OpenTextFile(“C:\log.txt”,1)
K = 0
str = “Current Schema Version is 44”
do Until filetxt.AtEndOfStream
LineVerify = filetxt.Readline
LineVerify = trim(LineVerify)
If InStr(UCase(LineVerify), Ucase(“Current Schema Version is 44”)) Then
K = 1
End If
Loop
if iReturn = 1 AND K = 1 Then
wscript.echo servername & “: Success”
Else
wscript.echo servername &”: Failure”
End If
loop
Find the copy of the script in the below link
http://powershell.com/cs/members/smtpport25.wordpress/files/psexec.txt.aspx
Troubleshooting Exchange 2007 Store Log/Database growth issues
One of the Interesting Issue with Many Exchange administrator faces and finds it difficult to address is Store Log/Database growth issue. Below is the link which has step by step instruction help you to find case of Database growth and logs in Exchange 2007 Mailbox Server
Powershell to pull out user with specific email address in them
If you wanted to pull out of user account who has specific email address in the mailboxes in the Orginisation then below script will help you to get the list
Get-Mailbox -ResultSize Unlimited | select DisplayName, Alias |export-csv C:\stats.csv
$csv = Import-csv -path “C:\stats.csv”
foreach($line in $csv)
{
$result = $Line.Alias
$Emailadd = Get-Mailbox $Line.Alias |select emailaddresses
$K = $Emailadd.EmailAddresses
foreach ($S in $K)
{
If (($S.smtpaddress -like “*domain001.com”) -or ($S.smtpaddress -like “*domain002.com”))
{
$result = $result + “,” + $S.smtpaddress
}
}
$result | Out-File C:\Result_output.csv -Append
}
You can download a copy from the below mentioned link
http://powershell.com/cs/members/smtpport25.wordpress/files/SpecificEmailaddressPullout.ps1.aspx
Disaster Recovery of Exchange 2007 Mailbox Server
If you are running in an environment where there is High Availability options like LCR or CCR or SCR step for the exchange mailbox then we need to make sure that you have at least Daily full backups on the Exchange 2007 Servers
Below are the some of the situation where you wanted to go for new Hardware
Your hardware has failed
You are performing a dial-tone recovery, where Active Directory is intact
You are performing a site recovery, where Active Directory is intact
When migrating a Client Access server, Hub Transport server, Unified Messaging server, or Mailbox server to new hardware
Steps to approach recovery of Exchange 2007 Mailbox Server
- Search for the Crashed mailbox server from the active directory users and computer and right click on the same and click on Reset
- Install same windows version on the new box with same service pack and hot fixes with same name of the Crashed Exchange 2007 mailbox server with the same IP address of the old machine. If IP address is changed then you may need to updated DNS
- Allocate the storage on the new server which matches the older server
- Install Exchange 2007 using command “Setup /M:RecoveryServer
- Install all the hotfix and rollup updates
- Create all the Required Storage groups and stores in the same naming standard
- Restore all the Database stores with options “This Database can be over written by restore”
- Mount the databases
- You can create the new public store and check if the replication is configured properly and allow public folders to get replicated from other public folder stores
- Then you may rebuild full text Index catalog. Index catalog helps to search for the documents and attachments in the messages. Index Catalog is for each Storage group
- Document helps to rebuild Search Index