Tuesday, 21 August 2012

How to set the forwarding SMTP Address through Powershell

You cannot set the Fowarding SMTP Address through EMC. But we can set it through EMC

If you want to forward the mails from local mailbox to outside the organization, we should follow the below steps in powershell

1. DeliverToMailboxAndForward:

set-mailbox -DeliverToMailboxAndForward $true

2. Forwarding Address

set-mailbox intials -forwardingaddress Username

3. ForwardingSMTPAddress

set-mailbox intials -forwardingsmtpaddress email@domain.com

Thursday, 9 August 2012

Get Large Mailboxes from exchange

Using the below script we can get the large mailboes report from the exchange 2007

Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Where {$_.TotalItemSize -gt 500MB} `
| Select-Object DisplayName, ItemCount, TotalItemSize, TotalDeletedItemSize, StorageLimitStatus `
| Export-Csv "BigMailbox$(Get-Date -f 'yyyyMMdd').csv" -NoType

Friday, 3 August 2012

How to set the pimary email address and making the existing one as secondary email address

Here is the script to set the primary email address and making the existing as the secondary. if we do so, if anyone sending a mail to old email address, we can avoid the NDR

Import-Csv d:\alias.csv | Foreach-object { Set-Mailbox $_.alias -emailaddresspolicyenabled $false -PrimarySmtpAddress $_.SmtpAddress }

how to change the primary smtp using login id?

$Users = Import-CSV c:\myfile.csv
ForEach($User in $Users)
write-host "Processing $($User.loginid)"
set-mailbox -identity $user.loginid -PrimarySmtpAddress $user.primaryemail -EmailAddressPolicyEnabled $false

Sankar M

Thursday, 2 August 2012

How to import file using Powershell

How to Import the file using powershell

Declare the variable to load CSV file.

C:\temp>$V = import-csv c:\reprot.txt

If you want to see the ouput in console , just type the $v variable, you will be shown with  content loaded into the text file

Then we have run the script line by line, so we must use foreach alias

$v | foreach {
$_.hide –eq “yes”
Write-host  “ $_.name will be set as $true”