Backing up The Latest File – Name Unknown

It’s a common enough issue for me that I want to be able to backup the latest backup of a database, and using variables to set date and time I never quite know what the filename of the backup will be.

::copy latest file to network server
set LF=
for /F %%i in (‘dir /Od /b *.sql’) DO set LF=%%i
:
echo%TIME% on %DATE%: Latest Backup is %LF% >> Backup.file
:
xcopy /Y %LF% \\networkserver\bugzilla

My solution is to sort the backup directory by date, and create a variable based on the filename of the most recent file.

I then echo the time and date to a file (Backup.file) so that I have a log of the backup process that I can check should I need to in the future.

Finally, the script copies the latest backup to a network location.

This was used in conjunction with my bugzilla backup script, hence the directory names, but it can of course be used for anything.

Automated Backup of Bugzilla Database on Windows

Bugzilla isn’t really designed to be used on Windows, but once set up its fairly easy to administer.

One obviously important thing is backing up the database. Using the niftily built in mysqldump I used the following solution. Note this assumes default settings were used in the installation of Bugzilla.

First, add mysql to the windows path if it hasn’t been done so already, by running up a command prompt:

PATH=%PATH%;C:\Program Files\Bugzilla\mysql\bin\

I then use a command file to create the backup dump, and then append the date and time to the file name. Note I have also created a user (backup) on the bugzilla database with a limited set of privileges (Select, Lock Table, Show Databases, Event).

rem commmand to dump the database to file
mysqldump -ubackup -pbackup Bugs > c:\bugsbackup\bz.sql

rem set date and time into useable file format
set _my_datetime=%date%_%time%
set _my_datetime=%_my_datetime: =_%
set _my_datetime=%_my_datetime::=%
set _my_datetime=%_my_datetime:/=_%
set _my_datetime=%_my_datetime:.=_%

rem rename file
ren “c:\bugsbackup\bz.sql” bz_%_my_datetime%.sql

This command file can of course be added to scheduled tasks and run as frequently as you want.

SecurityTools

This is a nasty little program that masquerades as a security program that has found lots of viruses on your PC, and will clean them if you unlock it – eg if you hand over your credit card details.

The easiest fix I’ve found is using ComboFix, and then deleting the [random letter/numbers] folders found under ‘\Documents And Settings\All Users\’.

Windows Home Server v2 (Vail) is dead in the water

I’m a big fan of windows home server. They failed to deliver on some things, such as Media Centre integration, but that doesn’t really bother me. It’s a decent piece of server kit with a nice UI built over the top of Server 2008.

The best feature of it has to be Drive Extender, a disk management tool that allows you to pool your drives, of any size, and provides one click duplication, making installing new disks and taking backups a breeze for the home user. The clue is in the title: Windows Home Server.

Vail has been in the works for a while, and a recent post on the WHS blog has announced that the number one feature has been stripped. I’m fortunate enough, I guess, in that I understand how RAIDs work, and know how to set them up. However, I use WHS because I don’t have too. I spend enough time at work with computers that I don’t want to at home.

Absolutely unbelievable. Microsoft manage to alienate their core customer base (of this product) in one fell swoop.

Still, at least it saves me the cost of the upgrade.

Userenv Error 1500/1505/1508 – Profile Unable to Login

Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, or that your network is functioning correctly. If this problem persists, contact your network administrator.

This annoying error message plagued me for quite a long time until I eventually found the solution. The problem appears to be with the pagefile not being able to perform user profile allocation properly.

After a fair bit of searching and tinkering, I eventually hit upon the following solution:

  • First set the pagefile to by managed by the system.
  • Load regedit, and find: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
  • Create a new DWORD called PoolUsageMaximum. Set this to 60 (Decimal).
  • Create/Modify PagedPoolSize (DWORD) to ffffffff (Hex).
  • Reboot.

What this does is simply force the Memory Manager in windows to attempt to trim the pagefile when it is 60% full, rather than its default 80%. This therefore starts the pagefile trim earlier, hopefully enabling the computer to cope with surges in memory demand more efficiently.

Windows Home Server

Well I finally got round to installing this on my custom built server, and I’ll tell you something, I quite like it. It’s easy to set up, easy to configure and easy to use. No worrying about what raid to use, just automatic duplication if desired. And automatic backups. Just whack in a few drives and away she goes.

Microsoft Haikus

Not mine, but amused me enough to post.

The Web site you seek

Cannot be located, but

Countless more exist.

*

Chaos reigns within.

Reflect, repent, and reboot.

Order shall return.

*

Windows NT crashed.

I am the Blue Screen of Death.

No one hears your screams.

*

Stay the patient course.

Of little worth is your ire.

The network is down.

*

A crash reduces

Your expensive computer

To a simple stone.

*

Serious error.

All shortcuts have disappeared.

Screen. Mind. Both are blank.

Disabling MSN & Live Messenger

There are quite a few guides on how to disable this viral little program. Sadly blocking it’s default port rarely works, because doing so causes the program to switch to port 80, which for most would mean blocking http traffic too.

Several ways to do this on the internet involve editing the registry, this is something that doesn’t appear to work any more.

The only way I’ve found that works is to edit the computers group policy (start > run > gpedit.msc). Under Administrative Templates and Windows components, you’ll find Windows Messenger. Simply set “Do not allow windows messenger to be run” to enabled.
Thats it.

Update: This doesn’t work for Live Messenger, one method I have found that uninstalls WLM completely is to run a command prompt (as administrator), and simply type: msiexec /x {B1403D7D-C725-4858-AACC-7E5FA2D72859}.