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}

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

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9a49c22e-e0c7-4b7c-acef-729d48af7bc9

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

 

http://blogs.technet.com/mikelag/archive/2009/07/12/troubleshooting-store-log-database-growth-issues.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

 

  1. Search for the Crashed mailbox server from the active directory users and computer and right click on the same and click on Reset
  2. 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
  3. Allocate the storage on the new server which matches the older server
  4. Install Exchange 2007 using command “Setup /M:RecoveryServer
  5. Install all the hotfix and rollup updates
  6. Create all the Required Storage groups and stores in the same naming standard
  7. Restore all the Database stores with options “This Database can be over written by restore”
  8. Mount the databases
  9. 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
  10. 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
  11. Document helps to rebuild Search Index

http://technet.microsoft.com/en-us/library/aa995966.aspx