Thursday, 28 May 2009

Defragment Exchange 2003 datastore

Over time the mail store for Exchange 2003 becomes fragmented. To resolve this the database needs to be taken offline which effectivley kills Exchange, then eseutil needs to be run on the mailstore files. After unmounting the mailboxes it is a good idea to make a backup of the mailstore just in case... for this to work free space of 110% of the mailstore is required. The *.stm file is automatically defragmented when you defrag the related *.edb file.

  1. In Exchange System Manager, right-click the information store that you want to defragment, and then click Dismount Store. (you probably want to tell people the server will be offline for several hours depending on the size of the datastore and speed of the server)
  2. Make a backup copy of the files in the mailstore directory somewhere safe!
  3. C:\program files\exchsrvr\bin> eseutil /d c:\progra~1\exchsrvr\mdbdata\priv1.edb

Note: eseutil.exe will create the temp files in the current working directory, make sure you have 110% of the file size you are working on as free space in this partition.
Note: On our server the pub1.edb (1.7GB) took 5 minutes to defrag and the priv1.edb (31GB) took about 2 hours

Wednesday, 27 May 2009

MiBew (AKA WebIM) Web chat system

Nice little chat program, usefull on web sites "Talk to an operator". Now renamed to Mibew (Webim backwards...)  Operates in a way similar to the "talk to an operator" popups on web sites etc.

We have been using this on our web site for a year or so now and its proved to be very reliable and easy to use.

Packages required on Debian 5.0
apache2 php5 php5-mysql mysql-server mysql-client

Linux user account setup (basic)

To change a password for another user:
# passwd [username]
To lock an account and unlock an account:
# passwd -l [username]
# passwd -u [username]
WARNING: If Locking the root account ensure that you have allowed and tested access with sudo first!
Users and Groups Creation and DeletionTo list the groups a user is a member of:
# groups [username]
# groupadd [groupname]
To create a user and set primary group:
# useradd -g [groupname] [username]
To create a user and set secondary group:
# useradd -G [groupname] [username]
To add group to existing users secondary groups:
# usermod -a -G [groupname] [username]
To delete a user:
#userdel -r [username]
-r deletes the users home directory as well as account

To see a summary of logins to date (leave username blank to see all logins):
# last [username]

Sudo setup

To use sudo setup users and groups using normal Linux then use the visudo command to edit the configuration file.

To allow members of the group to run any command as themselves:
%groupname ALL= ALL
To allow members of the group to run any command as any user with the exception of /usr/su:
%groupname ALL=(ALL) ALL, !/usr/su
Now prepend any command with sudo and it will run as root. If you forget you can rerun the last command with !! eg:
# visudo
Error, permission denied
# sudo !!
runs visudo as root

To run a command as a specific user:
# sudo -u <username> <command>

Tuesday, 26 May 2009

Use runas to access control panel on XP

NOTE:  This is less likely to work as the more patches are applied to Windows XP the more the base system changes and this executable may no longer be compatible (if its even there!)

With administrator access denied to Windows XP users it can be hard to maintain their desktops without logging out and in repeatedly. Previously it was possible to runas iexplorer.exe however this ability was blocked around XP SP2. On older XP machines however a backup of the IE6 exe is available (although it could be buggy as its not intended to be used).
Use the runas command on c:\windows\ie7\iexplore.exe, change the address to c:\ and hit the folders button. You now have a old style explorer window running as an administrator.  You can now access files, control panel etc.

Copy files to all user desktop over network

To copy a file to the all user desktop of a machine over the network use the following command:

xcopy /O testfile.txt "\\ws123\c$\Documents and Settings\All Users\Desktop"

/O - preserve permissions
/S - include sub directories and files

can not xcopy direct to \\machine\c$ - need to xcopy into a folder.

Give full access to the "domain user" group first so the end user can access the file. The xcopy command supports tab completion over the network which makes this easier.

Date and time stamped in linux history

To add the date and time to the history add the following two lines to /etc/profile:


Now the history command will also display when the commands were run, very useful for audit purposes.

Quick remote backup over ssh

To create a quick backup from one linux box to another the following command can be used (it will ask for your password on the remote machine unless you have setup ssh keys):

$ tar zcvf - /path/to/files | ssh user@remote-server "cat > backup.tgz"


I work as an IT Manager for a small (~50 people) company selling holidays. Because we are a small company and try to do most things in house I end up getting involved with everything from end user taining through VB macro writing in Excel to server and database installation and maintenance which is great fun. Trying to remember the obscure setting or program I last used 9 months ago is not so much fun which is why I try to make notes in this blog. Content is very specific without much background information but I decided to put this on the web in the hopes it might be hit by a few Google searches and be of use to someone.