Thursday, February 16, 2012

Exchange 2010 enable mailbox for multiple distribution groups


You can generate mailboxes for multiple distribution groups at the same time, the group names will be read from a text file. To do this:

Open Exchange Management Shell with Administrator rights, then:

Get-Content <OU_LIST_FILE> | Foreach-Object {Enable-DistributionGroup -Identity "$_" -Alias "$_" -DisplayName "$_" -PrimarySMTPAddress "$_@<FQDN_NAME>"}


Example:

Get-Content C:\oulist.txt | Foreach-Object {Enable-DistributionGroup -Identity "$_" -Alias "$_" -DisplayName "$_" -PrimarySMTPAddress "$_@ibs-t.hu"}

-> This will read OU names from the file 'C:\oulist.txt' and create the distribution groups defined in the file, in the domain 'ibs-t.hu'.
It's a simple text file, with the OU names under each other:

---BEGIN FILE---
grpGazd2006
grpGazd2007
---END OF FILE---

Output sample:

Name                          DisplayName                   GroupType                     PrimarySmtpAddress
----                          -----------                   ---------                     ------------------
grpGazd2006                   grpGazd2006                   Universal, SecurityEnabled    grpGazd2006@ibs-t.hu
grpGazd2007                   grpGazd2007                   Universal, SecurityEnabled    grpGazd2007@ibs-t.hu

Exchange 2010 enable mailbox for distribution group


Here's how to generate mailbox for a distribution group:

Open Exchange Management Shell with Administrator rights, then:

Enable-DistributionGroup -Identity "<GROUP_NAME>" -Alias "<GROUP_NAME>" -DisplayName "<CAN BE CUSTOM>" -PrimarySMTPAddress "<DESIRED E-MAIL ADDRESS>"


Example:

Enable-DistributionGroup -Identity "grpBattm2007" -Alias "grpBattm2007" -DisplayName "Battm2007" -PrimarySMTPAddress "grpBattm2007@ibs-t.hu"

-> This will create a distribution group named grpBattm2007 from a group named grpBattm2007, and set the display name of the group to Battm2007, with e-mail address of grpBattm2007@ibs-t.hu
The DisplayName parameter can be omitted, in this case the display name will be the same as the group name.

Output sample:

Name                          DisplayName                   GroupType                     PrimarySmtpAddress
----                          -----------                   ---------                     ------------------
grpBattm2007                  Battm2007                     Universal, SecurityEnabled    grpBattm2007@ibs-t.hu

Exchange 2010 enable mailbox for users in an OU


Use this command to generate mailboxes for all user accounts in a specified organizational unit:


Open Exchange Management Shell with Administrator rights, then:


Get-User -OrganizationalUnit <OU_NAME> | where-object {$_.RecipientType -eq "User"} | Enable-Mailbox -Database "<DATABASE_NAME>" | get-mailbox | select name,windowsemailaddress,database


Example:

Get-User -OrganizationalUnit Baibr2010 | where-object {$_.RecipientType -eq "User"} | Enable-Mailbox -Database "Student Mailbox Store" | get-mailbox | select name,windowsemailaddress,database

-> This will create mailboxes for all users in an OU named Baibr2010, and in the mailbox database Student Mailbox Store and domain ibs-t.hu

Output sample:

Name                                    WindowsEmailAddress                     Database
----                                    -------------------                     --------
Stiller David                           DSTILLER@ibs-t.hu                       Student Mailbox Store
Bayarsaikhan Oyunjargal                 OBAYARSAIKH@ibs-t.hu                    Student Mailbox Store
Puiu Roman                              RPUIU@ibs-t.hu                          Student Mailbox Store
Lajos Adrian                            ALAJOS@ibs-t.hu                         Student Mailbox Store
Raab Renata Rozsa                       RRAAB@ibs-t.hu                          Student Mailbox Store
Lang Lorand                             LOLANG@ibs-t.hu                         Student Mailbox Store
Lazar Zsolt                             ZSLAZAR@ibs-t.hu                        Student Mailbox Store
Li Cong                                 CLI@ibs-t.hu                            Student Mailbox Store
Tran Ba Duy Phuong                      BTRAN@ibs-t.hu                          Student Mailbox Store

Exchange 2010 move System Mailboxes to new database and remove the default mailbox database



After you’ve installed a new Exchange 2010 environment and you try to delete the first automatically created mailbox database, you’ll receive an error message, saying it still contains mailboxes.
You cannot remove the database, because there are still some hidden, system mailboxes in it, although it looks empty.
You will need to move these system mailboxes to a new database before this default database can be deleted.


Here are the steps to follow:

Open Exchange Management Shell with Administrator rights, then:

1. List the arbitration (system) mailboxes in the database you want to remove (the wrap parameter must be also specified, otherwise the full GUID name won't be displayed!):

Get-Mailbox -Database "<DEFAULT_DATABASE_NAME>" -Arbitration | ft -wrap -auto


Example:

Get-Mailbox -Database "Mailbox Database 0019304662" -Arbitration | ft -wrap -auto

Output sample (sorry it looks disorted in the blog):

Name                                                Alias                                               ServerName Proh
                                                                                                                   ibit
                                                                                                                   Send
                                                                                                                   Quot
                                                                                                                   a
----                                                -----                                               ---------- ----
SystemMailbox{1f05a927-6cae-4b43-9e78-20b3905e51b9} SystemMailbox{1f05a927-6cae-4b43-9e78-20b3905e51b9} mars       unli
                                                                                                                   mite
                                                                                                                   d
SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9} mars       unli
                                                                                                                   mite
                                                                                                                   d
FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042 FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042 mars       1 MB
                                                                                                                    (1,
                                                                                                                   048,
                                                                                                                   576
                                                                                                                   byte
                                                                                                                   s)

-> This means there are still 3 system mailboxes inside the first mailbox database (created by Exchange setup, called 'Mailbox Database 0019304662'), that we want to remove on the server named MARS


2. Move each system mailboxes to the new database, copy and paste their identity name from the previous command:

New-MoveRequest -Identity "<SYSTEM_MAILBOX_NAME>" -TargetDatabase "<TARGET_DATABASE_NAME>"


Example:

New-MoveRequest -Identity "SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}" -TargetDatabase "Employee Mailbox Store"

Output sample (sorry it looks disorted in the blog):

DisplayName               Status                    TotalMailboxSize          TotalArchiveSize         PercentComplete
-----------               ------                    ----------------          ----------------         ---------------
Microsoft Exchange        Queued                    80.16 KB (82,081 bytes)                            0


-> In this example, our target mailbox database is called 'Employee Mailbox Store'


3. Don't remove the default (in our case 'Mailbox Database 0019304662') mailbox database yet, first remove the move requests for these mailboxes from the Management Console.
If you forget this step, you will have to manually remove these corrupted move requests from the Management Shell, otherwise no move requests can be displayed in the Management Console.

Use this command to remove requests from the Management Console:

Remove-MoveRequest -Identity "<SYSTEM_MAILBOX_NAME>"


Example:

Remove-MoveRequest -Identity "SystemMailbox{1f05a927-6cae-4b43-9e78-20b3905e51b9}"

Output sample:

Confirm
Are you sure you want to perform this action?
Move request 'Microsoft Exchange Approval Assistant' is corrupted or not recognized: Source database for the move
doesn't match. Active Directory value: '(null)'. Move request value: 'Mailbox Database 0019304662'.. Are you sure you
want to remove it?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): y

-> Copy and paste the Identity name for the system mailboxes, repeat for each

After the move requests are removed, you can now delete the default mailbox database itself.
It will still leave the .EDB file in the Exchange directory, you will need to remove it manually.

Saturday, January 28, 2012

Laptop battery care

How to care your laptop's battery to prolong it's life?

Now that nowadays, there are many notebooks are sold than desktops, I think it's important to learn about how to care the battery in the laptops, if you intend to use it for a long time.
I like to share my own experience with laptop batteries.

With proper care, a battery can last very long and hold almost the same capacity over the time (but of course the maximum charge will always get less and less, it's normal, as it comes from the battery life cycle - the more you use it, the more it will get worn out).
If you don't use the battery, it will also get damaged, but more about that later.

My laptop's battery still have almost the same capacity as I bought it:
In 2008, it's factory capacity was 48400 mWh
Today, in 2012 it's capacity is 44400 mWh
(AIDA64 says it's 8% worn, and a few months ago it was still about 46000 mWh)

Of course it depends on each and every battery, that how long it will last, for example I saw a brand new laptop's battery is already worn out to 10%
So even if you make everything to care the battery well, but it still worn out very fast, that means it was faulty.

Here are my tips to prolong battery life:


1. Don't use the battery every time, it can die quickly if you use the laptop from battery often.
Use the laptop with the charger, leave the battery inside, and for example every month, use the laptop from battery 1-2 times, until the operating system says the battery need recharge. This way it can stay conditioned, and not over-used.
But if you forget to use the battery for a long time, it will also decrease it's life! If it stays always at full charge and never discharge, that will damage it.
Most laptops doesn't charge the battery always while you connect the charger, only after the battery reach 90-95% level, then recharge again. So don't worry and just leave the battery inside the laptop at all times.

2. At night, don't connect the charger to the laptop when you stop using it (disconnect the cable). At morning it will recharge that missing 3-10 percent again quickly, that also helps the battery.

3. Today's most common Li-Ion type batteries don't have "memory effect" like the older types, but the charge level can display wrong percent available battery life.
This is because the laptop's BIOS tells wrong data to the operating system, and the battery gauge level needs to be recalibrated.
Some laptops have this option in the BIOS, look for "battery calibration" or "recalibration" and be prepared it will run for a very long time, as it needs to fully charge then discharge the battery again.

Important: start the recalibration with 0% battery level only! If you don't do so, then it will give wrong data about the charge level again. To achieve 0% charge level, do the following:
When the operating system says you have to connect the charger to continue use of the laptop, don't do it just shut down the OS. Then turn on the laptop again, go into the BIOS and wait until the laptop turn off from no more battery charge.
After it turned off, you can connect the charger, and quickly go into the BIOS again to start the recalibration process.
This way it will display the correct charge level again.
Don't let Li-Ion batteries reach 0% charge level unless it's absolutely necessary - like the recalibration - as it can damage the battery!!

4. If you are sure you don't want to store the battery inside the laptop (although I recommend it), then don't store the battery fully charged, or fully depleted. Li-Ion batteries are best stored at charge level between 40-60%, and in a cool and dark place (however not too cold and not too warm, as extreme temperatures are also likely damage it).
Check the charge level every week, if needed charge it before you put it back to the storage again.

If you do like this, then you can have a good chance the battery will be good for at least 3 years.
For me it's now more than 4 years, but maybe I get lucky with this battery. :)
A laptop battery needs more care than a phone battery I think, but you can do similarly with your mobile phone battery.

Extra tip about cooling:

Be careful about not get too much dust in the laptop or near it, and have enough fresh air to be able to cool it  down (don't block the air vents and not put anything near the vents, up to 20-30 cm!).
Because most laptop problems come from overheat.
You can also clean the dust from the cooler, just that needs compressed air. Maybe it's a little bit expensive to buy, but it's good for cleaning laptops.
I clean the ventillator of my laptop at least every half year, then it doesn't get too much dust in the cooler.
When you use a laptop, it's ventillator get some dust from the air always (especially if you use it on a bed or a pillow, that blocks the ventillator).
If too much dust get inside in it, maybe the ventillator stops and the laptop overheats.
In this case it's not enough to clean it with compressed air, the laptop needs to be taken apart and the big dust must be cleaned from the laptop's cooler by hand.