Friday, November 25, 2011


You can do whatever you want, it's your decision and it's your life !
ကိုယ့္မွာတိတိက်က် စိတ္ကူးယဥ္ေမွ်ာ္မွန္းခ်က္ မရွိဘူးဆိုရင္ တိတိက်က် စိတ္ကူးရင္ေမွ်ာ္မွန္းခ်က္ ရွိသူေတြရဲ ့ ခိုင္းေစျခင္းကိုခံရလိမ့္မယ္။
I won't duck and run !
I won't duck and run !
I won't duck and run !

This world can turn me down but I Won't turn away

And I won't duck and run, cause I'm not built that way !
When everything is gone....
There is nothing there to fear
This world cannot bring me down, No cause I'm already here!

the bad news is that time flies. the good news... is that you're the pilot....

What i'm doing right now, everyday is like opening doors...
if i open the wrong one, all sort of bad things will come at me...
i gotta be careful which door I'm open...

If joy really comes in the morning time then I'm gonna sit back
and wait until the next sun rise....

Thursday, November 24, 2011

Squid Basic Auth

**Backup your existing squid.conf

Put/uncomment following lines to your squid.conf
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/squid_passwd

#auth_param basic program /usr/lib64/squid/ncsa_auth /etc/squid/squid_passwd <- 64bit Linux

ncsa_auth program is installed along squid in redhat flavours, under /usr/lib/squid/ . "/etc/squid/passwd" is the name of the file where all the passwords will be kept. You can change this to point to wherever you want in the file system.

auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
auth_param basic casesensitive off

First line below is an ACL named "authenticated_user"
Second line defines the networks in the LAN. This should be changed according to your setup. ( i just copied over from def: squid.configuration :-) )
The third allows http access through the proxy for Authenticated connections coming from the specified networks.
acl authenticated_user proxy_auth REQUIRED
acl our_networks src
http_access allow our_networks authenticated_user

Once you have made the above changes to the squid.conf you have to create the username/passwords in the specified file. ( /etc/squid/squid_passwd in this )

For that, do,
htpasswd -c /etc/squid/squid_passwd username password

After adding the 1st user in the above way, to add more new users, use the below method.
htpasswd /etc/squid/squid_passwd username password

You can find out various parameters you can use with htpasswd from the man page.

When everything is done, simply restart the squid service..

Thursday, November 17, 2011

Recover Mailbox / Database (Exchange 2010)

All of you know that there are no storage groups in Exchange 2010 and hence no recovery storage groups as well. A recovery database (RDB) serves the functions carried out by a recovery storage group in previous versions of exchange. Few points need to be understood before we start playing with restore options in 2010.

- You cannot create a recovery database using the console. Use shell instead (New-MailboxDatabase -Recovery -Name RDB -Server “servername” -EdbFilePath "path" -LogFolderPath "path” )
- Recovery database can only be used for 2010 databases. Previous versions are not supported.
- You cannot create mailbox database copies of a recovery database.
- Online maintenance isn't performed on a recovery database.
- You cannot enable circular logging on RDB.
- A recovery database cannot be used to recover public folder data.
- Only one RDB can be mounted on a mailbox server at any time.
- Access to RDB using Outlook or OWA is not allowed.
- Mailbox management policies are not applied on a RDB.
- Mailboxes in a recovery database cannot be connected to user accounts.
- Data from a RDB can be merged to an existing mailbox or exported to a folder.
(1) After you restored Logs and Database file in to M:\

(2) Check your Database file's health (Clean Shutdown or Dirty Shutdown)

eseutil /mh "M:\Recover\E\Exchange_Snap_31102011-2300-20732\Database\Operation & Exploration\Operation & Exploration.edb"

(3) Also check Log files OK or Not
eseutil /ml 'M:\Recover\D\Exchange_Snap_31102011-2300-20732\logs\Operation & Exploration\e00'

(4) Soft Recovery without (/i or /a) options
eseutil /r e00 /l "M:\Recover\D\Exchange_Snap_31102011-2300-20732\logs\Operation & Exploration" /d "M:\Recover\E\Exchange_Snap_31102011-2300-20732\Database\Operation & Exploration"

(5) Repeat step 2 for database health, if it's clean shutdown

(6) You can start create new recovery database via EMS command
New-MailboxDatabase -Recovery -Name DB-recover -Server ny-mb1-1 -EdbFilePath "M:\Recover1\Operation & Exploration\Operation & Exploration.edb" -LogFolderPath "M:\Recover1\Operation & Exploration"

(7) After you've created the recovery database, mount it.
Mount-Database -Identity DB-recover

(8) Get-MailboxStatistics -Database DB-recover

(9) To recover the mailbox from recovery database to live database
restore-mailbox -identity zawhtet -RecoveryDatabase DB-recover

(10) Restore mailbox from recovery database to itsupport's mailbox specific folder
restore-mailbox -identity itsupport -RecoveryDatabase DB-recover -RecoveryMailbox zawhtet -TargetFolder "ZawHtet recovery"

(11) Restore Specific EMails to folder
Restore-Mailbox -identityinfo -RecoveryDatabase DB-recover -RecoveryMailbox zawhtet -SubjectKeywords "fuck off" -ContentKeywords "Bitches" -IncludeFolders \Inbox\Calendar -TargetFolder "Zawhtet's lost folders"

(12) Restore all the mailboxes from recovery database
Get-Mailbox -Database DB-recover | Restore-Mailbox -RecoveryDatabase DB-recover

(13) Remove recovery Database
Remove-MailboxDatabase -identity DB-recover

If the above steps doesn't work, you need to make hard repair.

eseutil /p "M:\Recover\E\Exchange_Snap_31102011-2300-20732\Database\Operation & Exploration\Operation & Exploration.edb"

After the process successfully completed, you can start defrag the database

eseutil /d "M:\Recover\E\Exchange_Snap_31102011-2300-20732\Database\Operation & Exploration\Operation & Exploration.edb"

Monday, November 14, 2011

Exchange 2010 Adding New-Mailbox

- Install PowerShell 2.0 (Can be install on Windows XP SP2 / SP3)
- Open PowerShell then type "notepad $profile" without quotes.
- Notepad will come up named with "Microsoft.PowerShell_Profile.ps1
- Copy and paste following line

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Authentication Kerberos
Import-PSSession $s

- Save and exit the notepad.
- Open PowerShell
- Now you're ready to use PS.
(1) New-Mailbox -UserPrincipalName -Alias robertbg -Database 'Development Team' -Name 'Robert Gemmell' -OrganizationalUnit Development -Password (ConvertTo-SecureString -AsPlainText Pa55w0rd -Force) -FirstName Robert -LastName Gemmell -DisplayName 'Robert Gemmell'

(2) Set-Mailbox “robertbg” -MaxSendSize 20Mb -MaxReceiveSize 20Mb

(3) Set-CASMailbox robertbg -ActiveSyncEnabled:$false -OWAEnabled:$true -PopEnabled:$false -ImapEnabled:$false -MapiEnabled:$true

(4) Get-Service -name MSExchangeSA | restart-service (Type on Mailbox Server's EMS)


(4) restart-Service -InputObject (get-Service -ComputerName ygn-mb1-2k8 -Name MSExchangeSA) (from remote client's powershell)

(5) Update-FileDistributionService -Identity your-cas-server -Type OAB (Type on CAS Server's EMS or remote client's powershell)

(6) Test-Mailflow -TargetEmailAddress '' <- an email will received with message "This is a test message from Test-Mailflow"


Set-Mailbox -Identity dave -UseDatabaseQuotaDefaults $false -ProhibitSendReceiveQuota 2GB -IssueWarningQuota 1gb

Disable-Mailbox -Identity dave -Confirm:$false (Disable Account and mark dbase to delete)
Mail Enable for AD Users
Enable-Mailbox dave -Database Development Team

Get-User -RecipientTypeDetails dave | Enable-Mailbox -Database Development Team
Exchange Servers Monitoring Commands

Get-ExchangeServer | Test-ServiceHealth <- Check all the Exchange Services on all the exchange servers.

Test-ServiceHealth | Select-Object -Expand ServicesNotRunning | Start-Service

get-service *exch* <- check all the exchange services on local server

Get-Service *exch* | Where-Object {$_.Status -eq 'Running'} <- only running services

Get-ExchangeServer | ForEach-Object {Get-Service *exch* -ComputerName $_.Name | Where-Object {$_.Status -eq 'Running'}} <- check all the running services on servers

Get-Service MSExchangeAB -ComputerName ygn-cas-2k8 | fl * <- look detail on MSExchangeAB Service

Test-ServiceHealth | Select-Object -ExpandProperty ServicesNotRunning | Start-Service

(Start Services if not running)

Get-EventLog -list

Get-EventLog -LogName Application -Source *exch* -EntryType Error <- Only errors

Get-WmiObject Win32_LogicalDisk -Filter "DriveType='3'" | select @{n="Drive";e={$_.DeviceId}},@{n="Size";e={[math]::Round($_.Size/1gb,2)}},@{n="FreeSpace";e={[math]::Round($_.FreeSpace/1gb,2)}} <- check disk space on local server.

Wednesday, November 9, 2011