Friday, February 6, 2009

EmailAddresspolicy When migrating users from Exchagne 200x to Exchagne 2007

If you are migration from Exchagne 200x to Exchagne 2007 if you have Email policy with mulitple domains listed in the Exchange address tab and if you Primary smtp is not same as the DefaultEmail policy then once the mailbox is moved then you primary smtp address will get changed to email address which is set throught Defaultemail policy. The simple solution is you need to make sure that -EmailAddresspolicy should be disabled before you move the mailbox. This solves the problem.


$UserList = Get-Content "PathofTextfilecontactingusernames"
foreach($user in $UserList)
{
set-Mailbox $user -EmailAddressPolicyEnabled $false

}

Thursday, February 5, 2009

Creating Shared Calendar from Outlook in Public Folder

First Need to device where you want to create a public folder and you sufficient access on the folder inside which you wanted to create a Shared Calendar

1. Log into your mailbox using Outlook,Expand until you get required folder
2. Right-click on it and select New Folder in the pop-up menu.
3. Type in a name for the Shared Calendar, select Calendar Items in the Folder contains drop-down list and hit OK.

Right-click the Shared Calendar folder, select Properties.
Go to Permissions tab.
Hit Add and choose users and/or groups you wish to grant access permissions to.
Select required permissions level in the appropriate drop-down list and hit OK.

Wednesday, February 4, 2009

Powershell to Move Multiple Mailboxes in Multithread

This is a Beautiful piece of code which helps in moving the Multiple mailboxes in Multithread.

Sourcefilepath contact the text file with the list of alias names or email address of the users to move.
TargetDatabase should have the path of the destination store where mailstore to be moved.
Maxthreads 8 will move 8 users at a time, you can increase this count based on the performace of your machine.
-BadItemsLimit is if mailbox which is moved has some corrupted item then move-mailbox wil skip the corruption upto 30 items. If this corsses then specific mailbox will not be moved, but it will continue to move rest of the mailbox.


$TargetDatabase = "Path to the destination Store"
$k = Get-Content "SourceFilepath"
$k| Get-Mailbox | Move-Mailbox -BadItemLimit '30' -TargetDatabase $TargetDatabase -maxthreads 8 -Confirm: $false

Disable users from Creating and using pst

If you want users to not to user pst in their machines then please follow the steps

1. open Regedit from the computers and browse throught path
2. HKEY_LOCAL_MACHINE\Software\Microsoft\Office\11.0\Outlook\
3. Create a REG_DWORD with name DisablePst set Value: 1

Recovering Deleted email from the Outlook (Shift Deleted Mails)

Most of them have the wrong information that they can recover delete mails only from the “Deleted Mail” folder or they can recover from backup.

But you can always recover both Deleted (Soft Delete) and Shift Deleted (Hard Delete) with out recovering from backup. Recovering Delete mails depends on the Mailbox store policy set on the mailbox. If policy is set as 7 Days then you can recover mail until it is 7 Days old.

Steps
1. Open Regedit and go to below mentioned path
2. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Exchange\Client\Options
3. Create a DWord with name DumpsterAlwaysOn and set the value as 1
4. Select the folder in which mails got deleted then Click on Tool -> Recover delete items.
5. Select the mail which wanted to restore and click recover the same
6. Recoverd mail will be back in the orignial location.

Monday, February 2, 2009

Alerting If any Mails Struck in IMSS Trend Server Mqueue Folder

' This scripts can be scheduled every one hours in schedule task to check if any mails struck in the mqueue folder on IMSS Servers. If it find any mail then it wil alert to the email mentioned in the script. It can also has
Dim colFiles
Dim DtmOldestDate
Dim DtmNewstDate
Dim strOldestFile
Dim strNewstFile
Dim OldH
Dim NewH
Dim FileStatus
FileStatus = ""
Set objFSo = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Trend\IMSS\ISNTSmtp\mqueue")
Set colFiles = objFolder.Files
dtmOldestDate = Now
For Each objFile in colFiles
If objFile.DateLastModified < dtmoldestdate =" objFile.DateLastModified" stroldestfile =" objFile.Path" oldh =" DateDiff(" dtmnewstdate =" dtmOldestDate"> DtmNewstDate Then
DtmNewstDate = objFile.DateLastModified
strNewstFile = objFile.Path
NewH = DateDiff("h", objFile.DateLastModified, Now)
End If
Next

If NewH > 1 Then
wscript.echo "Latest file " & strNewstFile & " its " & NewH & " Hours old"
FileStatus = "Latest file " & strNewstFile & ", its " & NewH & " Hours old"
End If

If oldH > 1 Then
FileStatus = FileStatus & "
" & "Oldest file " & strOldestfile & ", its " & OldH & " Hours old"
Wscript.echo "Oldest file " & strOldestfile & " its " & OldH & " Hours old"
End If
Call Sendmail(FileStatus)
sub Sendmail(FileStatus)
If FileStatus <> "" Then
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Abc@toemailaddress"
objEmail.To = "Xyz@toemailaddress"
objEmail.Subject = "Mails struck in Mqueue folder on IMSS Name"

strBody = " Body of the message "

objEmail.HTMLbody = strBodyobjEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _ "SMTP Server" objEmail.Configuration.Fields.Item _ ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25objEmail.Configuration.Fields.UpdateobjEmail.SendEnd If
End Sub

VB Script to Find the Uptime of the server on the given machines list in text file

on error resume next
Set filesys = CreateObject("Scripting.FileSystemObject")
set filetxt1 = filesys.OpenTextFile("C:\scripts\Serveruptime\Serverlist.txt",1)

do Until filetxt1.AtEndOfStream
strComputer = filetxt1.Readline
strComputer = trim(strComputer)
set objWMIDateTime = CreateObject("WbemScripting.SWbemDateTime")
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colOS = objWMI.InstancesOf("Win32_OperatingSystem")

for each objOS in colOS
if err.number = 0 Then
objWMIDateTime.Value = objOS.LastBootUpTime
Wscript.Echo strComputer & " | " & objWMIDateTime.GetVarDate
Else
Wscript.Echo strComputer & " | "
End If
next
Err.clear
Loop