Welcome to the blog of mechanised.com

This blog is mainly a technical repository of information on Virtualisation tools and management for our hosting service.

Also for HP's Bladesystem that we use at both our datacentres.

Other articles are also included on .Net development and MS SQL Server as well as other interesting things we come across.

Friday 22 October 2010

IIS7 site and file synchronisation for web farms

If like us you have web farms of several machines serving a site in a cluster you may have come across the Microsoft Web Deployment tool.

This great bit of software allows you to sync all sites and their files from a master machine to all other members of the cluster automatically.

We have come across problems when a non administrator account is used for synchronising though.

To get round this we use the Web Management Service and a slightly different command line to sync with.

First, make sure the Web Management Service is on automatic and in Server Manager expand out the Roles/Web Server (IIS)/IIS Manager and choose the server instance, in the Management panel under Management Service you can enable remote connections. Then start/restart the service.

We then use a command line in this format:

msdeploy -verb:sync -source:webServer,wmsvc=,username=user1,password=password1,includeAcls=true -dest:webServer,wmsvc=,username=user2,password=password2 -enableLink:AppPoolExtension -allowUntrusted=true

As you can see the wmsvc service is used to authenticate, NTLM is the default authentication and if like us you use cloned servers the -allowUntrusted just bypasses the need to have an authorised certificate on the destination servers.

Just run multiple times in a batch for all the servers in the cluster and everything is all in sync!

Wednesday 13 October 2010

Server 2008 - remove old NICs so you can rename new NICs properly

Start a command prompt as administrator

Execute the following:



When device manager opens choose 'show hidden devices' from the 'view' menu.

You can then right click and uninstall any old NICs (shown as greyed out)

This is always a problem for us when cloning VMWare machines!

Monday 20 September 2010

Reset machine ID for WSUS clients

Good article on how to reset the machine ID for an imaged client so WSUS will see as an individual machine.

reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate /v AccountDomainSid /f
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate /v PingID /f
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate /v SusClientId /f
net stop wuauserv
net start wuauserv
wuauclt /resetauthorization /detectnow

Tuesday 27 July 2010

Open excel 2007 docs in multiple windows

Remove Excel 2007 annoying you by opening multiple xls files in the same window, this will open a separate instance when you double click an xls file.

My Computer
Folder Options
File Types
Choose XLS (or XLSX if you want)
Go to Advanced

Uncheck "browse in same window" in advanced window.

Then highlight Open

Make sure in the Action box it says &Open

Copy the following and paste into "application used to perform action":

"C:\Program Files\Microsoft Office\OFFICE12\EXCEL.EXE" "%1"

Check the box next to use DDE

Remove anything that is in DDE Message box and DDE Application Not Running box.

Make sure the application box says: EXCEL

And in the Topic box it says: System

Monday 19 July 2010

Quick fix for tables marked as crashed in MySQL

First off stop the MySQL database server:
/etc/init.d/mysql stop or service mysql stop
Go into the directory where the tables are stored:
cd /var/lib/mysql
Check each database for errors:
myisamchk -cs a*/*.MYI
If errors found then run the fix:
myisamchk -r a*/*.MYI
Once all checked and repaired, restart the service:
/etc/init.d/mysql start or service mysql start

Wednesday 14 July 2010

Installing VMWare open tools on RHEL5/Centos5

To install the latest VMWare open tools for RHEL5 or Centos5, first create a new file:
And put this in it:
name=VMware Tools for Red Hat Enterprise Linux $releasever - $basearch
Replace [esx-version] with 3.5u2, 3.5u3, 3.5u4, 3.5u5, 4.0, 4.0u1, 4.0u2, or 4.1, depending on the ESX/ESXi version.

Then use yum to install the server version, as no gui tools needed.
yum install vmware-tools-nox
Verify installation by:
service vmware-tools status
Should be shown as running, if not then use same command above but 'start' instead of 'status'

You should be able to see for the guest that VMWare tools is shown as 'Unmanaged' so tools will need to be updated on each guest manually.

Tuesday 27 April 2010

How to monitor an LSI MegaRAID controller within OpenFiler

Use wget to download the MegaCLI package from LSI you need the MegaCLI - Linux version

Extract the files eg.

rpm2cpio MegaCli-8.00.11-1.i386.rpm | cpio -idmv

and make sure you move the binaries into /opt/MegaRAID/MegaCli/

cd /etc/cron.hourly

Create a new hourly script to check the drives and send an email alert if there's a problem

vi MegaRAIDcron

cd /opt/MegaRAID/MegaCli
./MegaCli64 -AdpAllInfo -aALL | grep "Degraded" > degraded.txt
./MegaCli64 -AdpAllInfo -aALL | grep "Failed" >> degraded.txt
cat degraded.txt | grep "1" > /dev/null
if [[ $? -eq 0 ]];
./MegaCli64 -LdPdInfo -aALL | mailx -s 'Degraded RAID on '$HOSTNAME -r $HOSTNAME@youremail.com alert@youremail.com


chmod 775 MegaRAIDcron

You can test this works by running the script manually but replace the grep "1" on the 5th line with grep "0" so it'll send an alert if there are 0 failures instead of 1. Don't forget to change it back!

This script was adapted from this post on the Openfiler forums.

You can also send a daily/weekly overview email (to make sure it's still working!) by creating a similar file as above in the cron.daily or cron.weekly folder.

cd /opt/MegaRAID/MegaCli
./MegaCli64 -LDInfo -Lall -aALL >/tmp/MegaCli64.txt
mailx -s 'RAID INFO on '$HOSTNAME -r $HOSTNAME@youremail.com -v -a /tmp/MegaCli64.txt you@youremail.com

Friday 16 April 2010

Removing Linux server headers

Quick reminder to remove Apache and PHP server headers:

Edit /etc/httpd/conf/httpd.conf
Find ServerTokens and change to ServerTokens Prod

Edit /etc/php5/php.ini
Find expose_php and change to expose_php = Off

This will make sure fingerprinting a server for vulnerabilities is slightly reduced.

Friday 5 February 2010

HP Hard disc model matrix

Useful list of all HP drives and their part numbers, great for checking if a current P/N is a replacement for existing drives, especially as the single port drives are now being replaced with dual ports.