Categories
Computers Windows

Purge stale shadow copy data in Windows Vista

diskspace.gif

Some versions of Windows Vista comes with Volume Shadow Copy, a souped up version of the system restore function of Windows XP. Now, not only registry and core files are restored but any file on a protected drive can be restored to an earlier point in time.

If this feature is enabled on a drive, Windows Vista sets aside a significant amount of disk space to keep the old copies. Supposedly this space can be reclaimed by using the Disk Cleanup feature. I had partitioned my hard drive and installed Windows Vista. When reinstalling Windows Vista I only reformatted my system drive and later noticed that a large amount of disk space was not accounted for when adding the sizes of all folders on the drive.

It turned out that Volume Shadow Copy was not enabled on my data drive after the reinstallation, but the data was kept from the previous installation and just wouldn't go away. To see the shadow storage I opened a console as administrator and typed 'vssadmin list shadowstorage'. I enabled Volume Shadow Copy on the data drive and ran the Disk Cleanup, before I disabled Volume Shadow Copy. No luck.

From what I have been able to tell, the Disk Cleanup feature does not work in this case. When I did the same thing but instead of the Disk Cleanup function issued the following command (still in the administrator console) it worked:

vssadmin resize shadowstorage /For=D: /On=D: /MaxSize=300MB
Categories
Computers Windows

Put user data on another disk in Windows Vista

By default, Windows Vista, like all previous versions, insists on saving user data on the same disk as the system files. This may be fine for many people but I really don't want it to work that way. Before Windows Vista, you could edit the registry to move the folders around. Now in Windows Vista, Microsoft has added support to move the folders directly from within the file explorer which, in theory, should simplify matters. However, it doesn't always work and many applications fail to save in the new location. What is even worse, it appears to be impossible to change the location of the public folders from the GUI – even though the text in the GUI states that it is possible.

Realising that doing the changes via the GUI was totally worthless I tried to find another way. What worked very well for me was to change the two keys ProfilesDirectory and Public under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList.

The change to the key Public affects all users in the system whereas changing the key ProfilesDirectory only affects accounts that are created (or rather when the user first logs on) after the change was made. I recommend you create an Admin user at the end of the Windows Vista installation process, make the changes to the registry and then add normal accounts for the users who will use the system.

As always, be very careful when changing the registry as a mistake could potentially wreck your system.

Categories
Computers Linux

Use Ubuntu Live CD to backup partitions

After having run Windows Vista Ultimate unactivated for some time I decided it was time to install it properly and take a full backup of the system drive at intermediate steps along the way to be able to back-track later.

I could have used the built-in Volume Shadow Copy service, perhaps together with DriveImage XML. I did try that and even made a slipstreamed boot CD using Bart PE to be able to restore the system.

However, I wanted a little more control and the potential of being able to boot off a USB stick when restoring. I also wanted to backup to and restore from a network based NAS (in my case a DNS-323). Besides, Volume Shadow Copy is only available on Windows Vista Business and Windows Vista Ultimate whereas this method will work for virtually any system.

For the time being I have settled on the following process.

a) Download and burn the Ubuntu 7.04 desktop CD and use it to boot your computer

b) Start a terminal window and change to root

  > sudo su

c) Add repositories by adding /etc/apt/sources.list and uncommenting the two lines for universe repositories.

  > nano -w /etc/apt/sources.list

d) Update the sources and install partimage and smbfs (answer yes when requested)

  > apt-get update
  > apt-get install partimage
  > apt-get install smbfs

e) Mount the NAS over the network using the samba file system driver.

  > mkdir /mnt/backup
  > mount -t smbfs -o username:[login] //[ip]/[share] /mnt/backup

Replace the parts within square brackets with whatever is appropriate in your case.

f) Run partimage and select the partition to save and the filename where the image should be placed (somewhere below /mnt/backup where the network NAS share is mounted).

  > partimage
Categories
Computers Windows

Stop capitalising 'i' in Outlook

For years I have been annoyed by the fact that Microsoft Outlook insists on capitalising the letter 'i' when I write email. In Swedish 'i' means 'in' and is not to be capitalised like the pronoun 'I' in English. It was not exactly apparent how to stop this AutoCorrect (bad name in this case) feature.

For me, the 'bug' didn't manifest itself all the time but only when I wrote mail in plain text.

One would assume that application wide options for Outlook could control this behaviour. I could uncheck the 'Replace text as you type' option but that removed all corrections which was not what I wanted.

It turns out that the way to change the behaviour is to change the AutoCorrect options from within a plain text email (i.e. not from the main Outlook window). Just remove the i/I pair from the list of corrections. After that, 'i' will not be changed to 'I' in future emails.

StopAutocorrect_3.gif

Categories
Computers Windows

ATL smart device development with IE7

VS_WM_IE7_bug_small.gif

If you have tried to write ATL based smart device applications under Visual Studio 2005 on a computer running IE7 you may have seen this error message. This error is due to changes in IE7. Apparently the upcoming service pack for Visual Studio 2005 (scheduled for Q3 2006) will fix this issue but until that happens, this is how to do it.

Run regedit.exe and add an empty key under HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Ext \ PreApproved. Name the new key “{D245F352-3F45-4516-B1E6-04608DA126CC}”. Then restart Visual Studio.

You may also use the attached file.

Attachments

Categories
Computers Gadgets

Importing certificates on Samsung SGH-i320

As I wrote in a previous article I have recently got a Samsung SGH-i320. One of the first things I wanted to do was of course to set it up for push mail with an Exchange server. As probably just about every company out there has done, we have created our own root certificate which is used to secure the connection to the mail system over the web.

To enable the smartphone to synchronise over the air I did as I always do – I tried to downloade the public root certificate directly from our web site. I then got an error that said that my “security permission was insufficient to update my device”.

The problem stems from the changes to the security model of Windows Mobile 5. Different OEM manufacturers are probably free to control this to some extent because I did not have the same issue with my Qtek 9000 device.

Anyway, to fix this issue the solution is to find an application called RegeditSTG.exe. Allegedly, this is a HTC signed application but it worked fine on my Samsung phone. Search for the application on the net and copy the EXE file to your device and run it from the File Manager.

You will want to change a setting under HKLM\Security\Policies\Policies. The value to change is 00001017. It will probably be set to 128 and it should be changed to 144. Make a note of the old value in case you need to revert the change later on.

When this value was changed I could then install the root certificate, directly over the web or by running the file on the device.

Categories
Computers Windows

Enhancements for Windows Services for Unix

I found Windows Services for Unix by chance but has since got used to having a Unix-like environment on my Windows system, enabling me to more easily work with boxes running Linux.

If you have installed Windows Services for Unix (for a description of how to do it, please read this article) you might have realised that there are only so much you can do with the system out of the box. Many commands you take for granted in a Linux system are not there and some of those which are actually included don't behave quite the way you expect them to function.

Not to worry. The source code for most commands can be downloaded (www.gnu.org is a prime source) and compiled within SFU.

To save you the time to set up an environment with some tools that at least I found more or less necessary I provide a link to a set of scripts at the bottom of this post. The scripts automate the process of building the system by downloading and compiling the following applications:

To install, download the file below to a directory within your SFU installation (e.g. /tmp, normally c:\sfu\tmp from your Windows Explorer), then type the following from a C Shell window:

gunzip SfuPlus.tar.gz
tar -xvf SfuPlus.tar
cd SFU_Plus
./sfuplus.sh

The build process will take about 15 minutes on a modern computer. Slower computers may take more than an hour.

Attachments

Categories
Computers Windows

Install Windows Services for Unix 3.5

Microsoft Windows Services for Unix (or SFU for short) is a relatively unknown product. This is a shame since it can be quite handy for some people. And the price is definately right – free!

Contrary to other applications (e.g. cygwin) that attempt to provide a Unix/Linux envrionment under Windows, SFU is not an emulator running under Windows. Instead SFU provides a Posix subsystem that runs side by side with Win32 directly on top of the NT kernel. This should provide for better performance but I have not tested that myself. What I have found very nice, however, is that commands compiled and existing under SFU can be executed under Win32 anv vice versa.

Windows Services for Unix comes with a basic set of tools. Some of them are crippled in comparison with what you might be used to. In a separate post I will provide my setup script that adds a number of utilities (nano, wget, openssl, openssh etc) to the default setup.

To get started you need to download SFU from Microsoft and run the setup file. To help you I provide screenshots of all the steps necessary to set up SFU on your computer.

sfu_setup_1.gif

sfu_setup_2.gif

sfu_setup_3.gif

sfu_setup_4.gif

sfu_setup_5a.gif

sfu_setup_5b.gif

sfu_setup_6.gif

sfu_setup_7.gif

sfu_setup_8.gif

sfu_setup_9.gif

sfu_setup_10.gif

sfu_setup_11.gif

sfu_setup_14.gif

Categories
Computers Windows

Run Drupal on IIS

Of all the open source CMS solutions Drupal is one of my favourites (this site used to be run Drupal but has since been switched to WordPress). Installing it under Linux is normally a breeze since all of the requirements (PHP, MySQL etc) are already met by many popular Linux distributions. It requires a little more effort to install it on a Windows box and run it under IIS instead of under Apache but it is certainly doable.

Now why on earth would you like to do this, you may wonder. After all, Apache is available under Windows so why not just ditch IIS and go for Apache. Well, like me you may need to use IIS to run other sites that require IIS on the same server. While it would be possible to run both IIS and Apache on port 80 with some creative HTTP proxying it sure sounds easier to use a single server.

Install IIS

Depending on your version of Windows, Microsoft Internet Information Services (IIS) may not be installed by default on your machine. If it is not installed you should start by doing so – Start -> Control Panel -> Add or Remove Programs -> Add/Remove Windows Components.

Install MySQL

If you don't already have MySQL installed on your system then please go ahead and install it. The simplest way is to download the Windows Essential installation file. I also recommend the use of MySQL Administrator and MySQL Query Browser from the same web site.

Install PHP

Download PHP from www.php.net. Pick the zip file and not the installer. I use PHP 5.1.4 but it should work with any version supported by Drupal.

Extract the zipped file to a location of your choice. For the sake of this walk-through I will assume that you extracted it to C:\PHP\.

Add C:\PHP to your system path. From the start menu, right click on My Computer and select Properties. Then add a semi-colon followed by C:\PHP to the system path under the environment settings on the Advanced tab.

Create the directory c:\php\temp and give the account running the web site (normally IUSR_<computer name>) full permissions.

Copy the file c:\php.ini-recommended to c:\php.ini. You need to make at least the following changes:

  • Change extension_dir to “./ext”
  • Uncomment extension=php_mysql.dd
  • Uncomment extension=php_gd2.dd
  • Change upload_tmp_dir to c:\php\temp
  • Change sendmail_from to a valid email address

Using regedit.exe, add a setting to the registry within HKEY_LOCAL_MACHINE\Software\PHP:

IniFilePath  [SZ]  C:\PHP\

Install Drupal

Create a new directory to hold the virtual directory (or use the default site).

Download the Drupal installation file and extract it to the IIS virtual directory. The Drupal installation file is provided in a tar.gz format which Windows is normally not capable of opening. 7-zip is a good option if you have an issue with opening the file.

Create the directories 'files' and 'temp' within the Drupal site structure (if they don't already exist) and give the account running the web site (normally IUSR_<computer name>) full permissions to those directories.

Use MySQL Administrator to create a MySQL account that will be used by the site. Still from within MySQL Administrator, create a new database and give the account full permissions to that database.

From the Drupal directory, issue the command:

mysql -u [drupal account] -p [drupal database] < database/database.4.1.mysql

Edit the value of $db_url within the Drupal file /sites/default/settings.php to match your database and account settings.

Fix for clean paths

To support clean paths there must be a way for IIS to support URL rewriting in a similar way that mod_rewrite does it for Apache. There are a number of such utilities but most of them are provided at a charge. I found IIRF which does the job and is provided free of charge so go ahead and download it.

Change the ini file to be (remove or comment out existing lines):

RewriteRule /index\.php\?time=(.*)$ / [R]

# Add a slash in front of image URLs
RewriteRule my_theme/files/(.*)\.(?:jpg|jpeg|gif|png) /files/$1\.$2 [L]

#Allow direct access to some static information
RewriteRule /(.*)\.(?:css|jpeg|jpg|gif|png|js|ico) /$0 [L]

# Don't rewrite certain URLs
RewriteRule (.*)\?q=(.*) $0 [L]
RewriteRule ^/cron.php(.*)$ $0 [L]
RewriteRule ^/update.php(.*)$ $0 [L]

# Fix problem with links to next and previous pages
RewriteRule (.*)\?page=(.*) /\?q=$1&page=$2 [L]

# Change URLs in forms
RewriteRule ^/(.*)\?(.*)$ /$1

# Change the URL to query format
RewriteRule ^/(.*) /\?q=$1 [L]

The support to test the clean URL function in Drupal 4.7 is dependent upon .htaccess which is Apache related. Under IIS this has the effect that it is impossible to turn on clean paths from within the administration web pages. Instead you will have to add the following to your Drupal settings file (/sites/default/settings.php) in your Drupal directory.

$conf['clean_url'] = 1; // 1 enables, 0 disables

Hopefully that should do it. Good luck!

Categories
Computers Linux

Install Bind on ClarkConnect Home 3.1

ClarkConnect is a nice Linux distribution for a home server and it is especially suitable for a computer sitting in a closet without a display as the web based GUI makes it a snap to configure it (even if you, like me, after a while tend to do all the maintenance through a SSH console connection).

Many people that use ClarkConnect will probably want to use it to host their own sites. At least I did and I quickly realised the limitations of the included caching DNS server (dnsmasq). It is very well for supporting local users that want to access Internet access but it is no good for holding your master DNS information. After some trouble I managed to switch the included dnsmasq to the full-blown ICS BIND implementation.

While I initially did this for ClarkConnect Home 3.1 and later upgraded my server to 3.2 it should work for ClarkConnect Home 3.2 as well.

I assume that you have a standard installation of ClarkConnect Home 3.1/3.2 and have learned how to get a SSH connection to your server.

Note that I have used RPM files to install as I didn't have the development packages installed at the time I did this. If you want to compile Bind yourself then that is of course possible.

  1. Ensure that the caching DNS server (dnsmasq) is disabled from within the web GUI of ClarkConnect so that it does not start when the server boots.
  2. Download the RPM files from http://www.isc.org/index.pl?/sw/bind/. Use the link for Red Hat RPMs under Documents/References. Select RHEL-4 -> 9.3.2-4_EL4 -> i386 and download all the files to a temporary folder on your server.
  3. Update the existing components of ClarkConnect by issuing
    rpm -Fvh bind-libs-9.3.2-4_EL4.i386.rpm
    rpm -Fvh bind-utils-9.3.2-4_EL4.i386.rpm
    

    You can also put those two files in a directory and run “rpm -Fvh *.rpm”

  4. Put all other files except bind-sdb-9.3.2-4_EL4.i386.rpm in another temporary directory and issue the command “rpm -Fvh *.rpm” from within that directory.
  5. The installation will put a default configuration file at /etc/named.conf. Edit it so that it looks something like this (replace the domain for your domain)
    // Default named.conf generated by install of bind-9.3.1-1
    options {
            directory "/var/named";
            dump-file "/var/named/data/cache_dump.db";
            statistics-file "/var/named/data/named_stats.txt";
    };
    include "/etc/rndc.key";
    zone "example.com" in {
            file "master/example.com";
            type master;
            allow-transfer { any; };
    };
    
  6. Create a folder for primary DNS zones:
    mkdir /var/named/chroot/var/named/master
    
  7. Add a zone file for your domain. My file (/var/named/chroot/var/named/master/example.com) looks like this:
    $TTL 2d
    @               IN SOA          dns.example.com. postmaster.example.com. (
                                    2005082502      ; serial
                                    3h              ; refresh
                                    1h              ; retry
                                    2d              ; expiry
                                    1h )            ; minimum
    example.com.    IN NS           dns.example.com.
    example.com.    IN MX           10 mail.example.com.
    www             IN A            10.11.12.13
    mail            IN A            10.11.12.13
    dns             IN A            10.11.12.13
    
  8. After changing the zone file you should restart the DNS server by issuing “/etc/init.d/named restart”. Run “tail /var/log/messages” to make sure that the daemon could read your zone file correctly. Use nslookup from another computer to verify that the server can resolve names for the domain.
  9. Put a soft link in /etc/rc3.d to the file /etc/init.d/named to make the daemon start automatically when the server is booted
    ln -s /etc/init.d/named /etc/rc3.d/S12named
    
css.php