Changing password of Exchange 2003 users throught Exchange 2007 OWA

Changing password of user can be done throught OWA.  If you are running Exchange 2007 environment on Windows 2007 with IIS 7.0 and also has Exchagne 2003 users then changing password throught Exchagne 2007 OWA would not be possbile you will get “404 page not found” Error message.

 As The Change Password feature in Exchange Server 2007 Outlook Web Access does not require the IISADMPWD functionality.  IISADMPWD functionality is used to change password in Exchange 2003 servers. 

Work around solution

1. When user is in inside office network then he/she can access OWA throught http://exchnage2003servername/exchagne/username

2.  a. Create the appropriate IISADMPWD folder and virtual directory on each Client Access server
b. Change the registory in Exchange 2003 backend serves – Click Start -> Run -> type regedit -> ok
c. Expand to the this path HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSExchangeWeb\OWA
d. Right click and create new DWORD with the name Disablepassword and set value to 0
e. On each Client access server, open IIS Manager, and then select Web Service Extensions.
f. In the result pane, select Active Server Pages, and then click Allow.

 

Reference Page : http://technet.microsoft.com/en-us/library/bb684904.aspx

VBscript to copy file to the remote computers

Below is the VB script to copy a file from local computer to list of remote computers

On Error Resume Next
Const ForReading = 1
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objTextFile = objFSO.OpenTextFile(“C:\server.txt”, ForReading)

Do Until objTextFile.AtEndOfStream
 strComputer = objTextFile.Readline
        objFSO.CopyFile “C:\regsetting.bat” , “\\” & strcomputer & “\C$\”
        wscript.echo strcomputer & ” Copied”
Loop

Powershell to find the size of Spam Mails folders in the Exchange mailbox

Below script can be used to find the size of spam  Mails folder in the User mailbox for the given list of users. Export list of users from the server throught below command and input into the Name.txt and Execute 

Get-mailbox | Where{$_.Servername -eq “Servername”} | select-object Alias > c:\Names.txt

 
$UserList = Get-Content “C:\Names.txt”
foreach($user in $UserList)
{
     $Spamsize = get-mailboxfolderstatistics $user | Where {$_.Name -match “Spam”}  | select  FolderAndSubfolderSize
     $output = $user + ” ” + $spamsize.FolderAndSubfolderSize/1mb
     Write-output $output 
}

Activeroles Quest Management Powershell to check User account Active or Disabled

You can download Active roles Quest Management shell from the below mentioned link.

http://www.quest.com/powershell/activeroles-server.aspx

Commands to check if mailbox is active or disabled

Get-QADUser <username> -enabled              

Will get the result if acount in active

Get-QADUser <username> -disabled                

Will get result if account is disabled

Get-QADUser  -Enabled       

Will get  all the enabled in the Active Directory

Get-QADUser  -Disabled      

Will get all the disabled users in the Active Directory

get-content “C:\users.txt” | Get-QADUser -enabled | select Email 

Will get list of all active users email address from the given input users

Powershell to get top 100 mailboxes in the Exchange 2007 server

Below Powershell script gets you the top 100 mailboxes from an Exchange 2007 server in the sorted format

Get-MailboxStatistics |sort totalitemsize -des | select-object Displayname, ItemCount,@{name=’TotalItemSize(MB)’;expression={$_.totalitemsize/1MB}}  -first 100

Top address 100 mailbox in the specific Exchange server. You can always modify the count as per your requirement. -first xxx has to modified to get the expected count result.

$MailboxServer = <servername>

Get-MailboxStatistics | ?{$_.ServerName -eq $MailboxServer }|sort totalitemsize -des | select-object Displayname, ItemCount,@{name=’TotalItemSize(MB)’;expression={$_.totalitemsize/1MB}}  -first 100

 

Below powershell will get the list of top 10 mailbox from the specific Exchange database or Store

$database = <database>
Get-MailboxStatistics | ?{$_.Database -eq $database}|sort totalitemsize -des | select-object Displayname, ItemCount,@{name=’TotalItemSize(MB)’;expression={$_.totalitemsize/1MB}}  -first 10

VBscript to check if SCOM agent is installed on a given list of servers

Below scripts takes input list of servers as input and generates the out with list of scom agent installed servers  and also get the details like start mode, current status etc

on error resume next
Set filesys = CreateObject(“Scripting.FileSystemObject”)
set filetxt = filesys.OpenTextFile(“C:\scripts\Server.txt”,1)

do Until filetxt.AtEndOfStream
 name = filetxt.Readline
 strComputer = trim(name)

 Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)
 Set colServices = objWMIService.ExecQuery (“Select * From Win32_Service”)

 For Each objService in colServices
 
  if objService.Name = “HealthService” Then
   wscript.echo  strcomputer & ” – ” & objService.Name & ” – ” & objService.State & ” – ” &objService.Startmode
  End If
       
 Next
loop

Powershell to Get the list of Live Servers

Below Powershell script take list of servers as input and it pings the server, if servers replies then it will writes Live server name in C:\scripts\serversRunning.txt.

 $ServerList = Get-Content “C:\scripts\Serverlist.txt”
foreach($Server in $ServerList)
{
                 $Server
                $ping = New-Object System.Net.NetworkInformation.Ping
                $reply = $null
                $Server = $Server.trim()
                $reply = $ping.Send($Server)
                if ($reply.status -eq “Success”) {
                $out = $Server | out-File “C:\scripts\serversRunning.txt” -Append
                } else {
                        $Server | out-File “C:\scripts\serversnotpinging.txt” -Append
                }
 }

Difference Between Disable-Mailbox and Remove-mailbox

Disable-Mailbox : It will detach the mailbox(removed exchange attributes) from the Ad user objects and adds detached mailbox to the disconnected mailbox list

Eg:  Disable-Mailbox username

Delete-Mailbox: It will delete Mailbox and Ad object and moved to Disconnected mailbox list.  Disconnected mailbox will exists until Deletion settings set in the mailbox store. Any time we can go and reconnect to the disconnected the mailbox.

Eg. Remove-Mailbox username -Permanent

-Permanent option will permanently deletes the mailbox and with out moving to Disconnected mailbox list.

Finding all the email address used in public folders and their path

Right click on Active directory users and computers -> Find -> Select the option as Exchange Recipients -> Make sure that you select only “Mail Enabled public folders” and uncheck others -> Click on Find now to get the list of all the email address used in public folders with their respective mail enabled public folder name.  Below is the snap of the same

You can use PFDAVAdmin tool to find the path of all the public folders in the orginization.  You can download the tool from the microsoft site. Open PFDAVAdmin.exe -> File connect  -> Input exchagne server name which has public store, GC name, authentication and select public folder. This will get Public fodler and System folder list. Select public folder-> Tools -> Export Properties -> Enter the file path in the output file and click ok to export the complete details of the public folder to the output file.

Open the output file to get the details

Automating Exmerge 2003 and Exmerge 2000

First need to download Exmerge.exe from the below mentioned link and extract the files to c:\Program Files\Exchsrvr\bin of Exchagne 2003 Machine

http://www.microsoft.com/downloads/details.aspx?familyid=429163ec-dcdf-47dc-96da-1c12d67327d5&displaylang=en

  • *************************************************************************

Then you need to list of list of users you wanted to exmerge at a time. Use the below given VBscript to get the legacyDN name for the list of users given the text file as input.  It creates a file called Legacyaddresses.txt

Dim filesys,filetxt
const ForReading = 1, ForWriting = 2, ForAppending = 8
InputFile = Inputbox(“Enter Path of the txt file”)
InputFile = trim (InputFile)
if InputFile = “” then
wscript.echo “You did not enter the user name. Script Quits!! ”
wscript.quit(0)
end if

set objShell = Createobject(“Wscript.Shell”)
drivepath = objShell.CurrentDirectory
set rootDSE = GetObject(“LDAP://RootDSE“)
DomainContainer = rootDSE.Get(“defaultNamingContext”)

set conn = CreateObject(“ADODB.Connection”)
conn.provider = “ADSDSOObject”
conn.Open “ADs Provider”

Set filesys = CreateObject(“Scripting.FileSystemObject”)
set filetxt1 = filesys.OpenTextFile(InputFile,ForReading)

fulname = drivepath & “\” & “Legacyaddresses.txt”
set filetxt = filesys.OpenTextFile(fulname,ForAppending,True)

do Until filetxt1.AtEndOfStream
 name = filetxt1.Readline
 name = trim(name)
 strLDAP=”<LDAP://” & DomainContainer &”>;(&(mailnickname=”& name &”)(objectCategory=person)(objectclass=user));adspath;subtree”
 set ocomm = createObject(“ADODB.Command”)
 ocomm.ActiveConnection = conn
 ocomm.CommandText = strLDAP
 set rs = ocomm.Execute
 if rs.EOF then
  wscript.Echo name & ” did not found!”
 
 else
  set FoundObject = GetObject(rs.Fields(0).Value)
  filetxt.Writeline(Foundobject.legacyExchangeDN)
 
 end if
loop

                                        ****************************************************************************

You Extracted 2  files Exmerge.exe , ExMerge.ini c:\Program Files\Exchsrvr\bin. 

Exmerge.ini contatin detail descrition on export and import from and to PST of the mailbox. Find the below mentioned lines the Exmerge.ini and edit as given below

1. MergeAction = Set value to 0

2. SourceServerName = Give any one server name in the Exchange Administrative group

3. DataDirectoryName = Give the path details where you wanted to export the pst (Ex. D:\ExmergeData)

4. FileContainingListOfMailboxes = Give the  path of the Txt file which has list of legacyDN addres of the users which u exported from the above script (Eg. D:\ExmegeData\Mailboxes.txt)

5. Go command prompt and type c:\Program Files\Exchsrvr\bin\exmerge.exe  -F c:\Program Files\Exchsrvr\bin\exmerge.ini -B -D

6. This will Export all the mailbox specified in list to PST to the given location which is mentinoed in DataDirectoryName, You can add the above line in the batch file and schedule it. Need to make sure that you have sufficient rights on the mailbox for the export.

7. Limit the mailbox you export at a time, depending on the performance of the machine. You can limit the mailbox export by limiting the number of mailboxes in mailboxes.txt which is refered by  FileContainingListOfMailboxes