Deleting files older than a specific date or age

I needed to delete a chunk of cookies today – but I didn’t want to delete them all.

Thankfully there is a handy command that is within Windows versions after XP such as Server 2003 and Vista that will enable to clean up without too many problems.

The forfiles command will allow you to set a specific date for a file so that you don’t delete recent cookies:

<code>forfiles /S /p "C:\Users\John\cookies" /D -150 /c "cmd /c del @path"</code>

If you wanted to be super cool and delete multiple user cookie folders you could do something like this:

<code>for /D %D in (C:\Users\*) DO forfiles /S /p "%D\cookies" /D -150 /c "cmd /c del @path"</code>

This will enumerate all of the user folders in the C:\Users folder and then clean up the cookies folders inside.

If you wanted to – you can change the amount of days from 150 days to any other amount you like by changing /D -150 to any other number of days (or even use a specific date).

Stop Windows Server 2003 Hanging When Installing Updates

Some of the servers that I manage in locations have a nasty habit of hanging on the final stage of rebooting when trying to apply Windows Updates automatically.

In most locations, I use WSUS to deploy updates around the site which is OK, but when it comes to servers problems arise.

After roaming around on the internet, I found a useful thread at EggHeadCafe which describes the problem I’m having. Apparently, turning off the default user screensaver using the following registry key will solve the problem:

HKEY_USERS\.DEFAULT\control panel\screensaveractive
Set the value to 0

This would make sense, as there is a similar problem in Windows XP where if you try to shutdown the system with the power button (or an update) while the screen saver is active, the system will shutdown until the screensaver is turned off by touching the keyboard or mouse.

I’ll find out if this works in a month’s time!

EDIT: Just logged onto one of my servers with this change and it works a treat.

Vista, Why You Eat my Computer?

So, Vista’s been out for a while now – some people think it’s great (usually they are selling it), some think that it’s pants.

Now, I’m not far from the front of the queue when it comes to raving about Linux. Ubuntu was the second Linux distro that I have tried, and I’ve stuck with it quite happily. In fact, things have remained pretty good from my initial post about my first experiences with Ubuntu.

On the other hand, Windows has it’s own place in the world. If you’re a person who can afford Microsoft’s astronomical licensing costs – then Microsoft can offer you some great things too.

Unfortunately, I don’t feel that Windows Vista is one of those great things.

Slug on Mogadon

The thing that strikes me whenever I use Vista is that it is so slow. Not just slow, but slooooooow. I have to use a variety of systems, and when I need to fix somebody’s laptop that is running Vista I should be putting an afternoon aside.

This isn’t entirely Microsoft’s fault. Consumer greed, business greed and the general desire to get more for less has also led to this rocky road to Hell. Computers and notebooks are generally sold cheap. Cheap means under-spec. Even up to the end of Windows XP’s golden lifespan (I’m not saying it’s past it, by the way), computer manufacturers were selling new systems with 256MB RAM. I’m sorry, but I’ve used Windows XP enough to know that as soon as you put on Service Pack 2, some anti-virus software, maybe some anti-malware package and then decide to run a few applications – time begins to speed up around you. Either that or the computer is running slowly. You decide.

Now Vista has mammoth requirements for what is essentially a core program. The minimum amount of RAM to run Vista is 512MB. That’s what I say is minimum for XP nowadays. I recommend having more than 1GB RAM installed for a pleasant Vista experience.

The problem is, noteboook manufacturers might even stump up the extra £5 to put 1GB of RAM in – but when 256MB of RAM is then being stolen by the onboard graphics so that you can see the Aero effects, things are clearly still not right.

Vista will run well on a decent, modern computer system. The problem is that Joe Public will be sold some tat from PC World by a part-time A-level student who will bestow Vista’s Flip-3D as a major selling point. Oh, it can burn DVDs as well.

Real Life

When real-life steps in, this is unsuitable for a lot of computers. Microsoft wants business to be using its latest baby, but on any existing hardware – Vista just doesn’t make the crunch.

My computer is almost 4 years old and runs Ubuntu beautifully. I have 1GB which more than meets any application requirements. In fact, this only becomes a problem when I run Windows XP in a virtual machine. Ironically, XP demands more memory running a few apps than the operating system that it is running on! And Ubuntu has a barrel more services, a 3D desktop, and (when I’m using it), about 10-15 application windows open!

Dual-boot

So I’m dual-booting into Vista at the moment. I do this when I fancy a game of Command and Conquer Generals with my brother over the internet. I often say, “I’ll just boot into Windows – give me 15 minutes.” Usually by the end of that time Windows may have finished messing around with updates, defragging, loading unneccesary services and generally being slow (on a 2.4GHz P4 with 1GB RAM), before I feel that I can get the thing to behave and run reasonably well.

I’ve been stung enough times when Vista decides that the ideal time to start defragging my hard disk drive and running an anti-spyware scan is during the middle of a game.

False Hope

When I was using the Beta versions of Vista, it was slow – but I figured that it was due to being a Beta. There was a clear effort from Redmond to meet Vista’s release date and there was a buzz. Vista naysayers were told to wait for the RTM (release to manufacturing) version. But overall, the performance wasn’t a great deal better in the RTM version.

More False Hope

Service Pack 1 was a glimmer of hope. Some performance increases and a rollup of some updates that fix what I can only describe as stupid problems that should never have been in the RTM version (such as having to Activate Windows after it has already been activated).

I thought I’d give this a try on my system. Guess what? It didn’t install. I wasn’t surprised. The update need prerequisites installed, and othr bits and bobs. I’d already had difficulty getting these installed on other computers, so I have a grave thought that it would mess up my system.

It didn’t install – but at least it didn’t wreck my system. Microsoft’s answer is to just keep trying until it works. Umm, I don’t have hours to piss away waiting for my work computer to continuously fail to install an update that takes around an hour to work out if it wants to install or now.

So, I gave up after attempt 3 or 4. I tried installing manually from the downloads. It’s not right. Vista feels inherently broken.

Time to Upgrade

So it’s time to upgrade to XP. It’s a joke I’ve seen floating around the internet for a while now, but it’s exactly how I’m feeling. I’m going to dual-boot into XP for playing games. It can run fast, and doesn’t have some of the hardware quirks that I’m still experiencing with Vista.

Over time, my disappointment with Vista has settled. It’s OK – but it’s extremely lacking in key areas. And these key areas tip the boat for me.

I’m just thankful that I run a Linux O/S as my main home operating system. I know it’s stable. I know it will behave itself most of the time. It’s still frustrating to use occasionally, but these times of frustration occur much less than when I use Vista.

Enabling Group Favourites on a Network

One of the tricky things about managing Favourites for users on a network is that it’s a nightmare to easily deal with the varied requirements of users.

Generally, you would set up favourites on a Windows network to do one of the following:

  • Leave them as they are. Users can add and remove their own favourite websites
  • Redirect favourites to a shared location with a registry hack – but users lose their personal favourites
  • Add favourites through Group Policy – but you need a network admin to do this whenever something needs to be added.

Now, there’s a groovier, sexier way to do it. You can finally have your cake and eat it. The best part (or worst part depending on your point of view) is – the solution has been there all along.

Before We Start

You’ll need:

  • A Windows-2000 based network with group policy enabled, and an Organsational Unit with user accounts inside.
  • The Group Policy Management Console installed on either the server or a workstation that you will use
  • Administrator Rights

You also need to ask yourself who will have the rights to add shared favourites. This is fairly important, so consider it sensibly.

Getting Started

First of all, log on to a server and run the Active Directory Users and Computers console.

Somewhere in the AD structure, create a new security group called ‘FavouriteManagers’. Next add the users who you want to allow to change favourites to this group. If you don’t mind who changes the favourites, you can skip this step.
1-addgroup.png
This is the group who will be allowed to add favourites to the users. Once you’re done here, and you are happy with the users who are set up in this group – we can set up the tool.

Setting Up the Group Policy to Allow Favourites to be Modified

Log onto your server / workstation as an administrator and do the following:

  1. Open up the Group Policy Management Console, and find the OU where the user accounts you want to control are.
  2. Right-click on the OU and select, Create and Link a GPO here… Call the new policy ManageFavourites.
    2a-addusers.png
  3. Now click on the new policy, and click on the Delegation tab. Click Add… and add the FavouriteManagers group to have edit access
    4a-addusers.png4-addusers.png
  4. Click on the Details tab, and select Computer Configuration Settings Disabled from the drop down list. This will ensure that the logon times are kept brief for users.
    5-compsettings.png
  5. Close the Group Policy Management Console.

Create the Change Favourites

  1. Open a new Microsoft Management Colsole (Start > Run > type mmc > click OK)
  2. Click File > Add/Remove Snap-in
  3. Click Add…
  4. Click Group Policy Object Editor and click Add
  5. Click Browse, then All, double-click on the ManageFavourites policy.
  6. Click Finish. Click Close.
  7. Click on the Extensions tab and select Group Policy Object Editor from the dropdown list.
  8. Untick the Add all extensions checkbox. Then deselect all but the Internet Explorer
    6-gpconfig.png
  9. Click OK.
  10. Expand the tree to User Configuration > Windows Settings > Internet Explorer Maintenance.
  11. Right-click on URLs and select New Window from Here
    7-gpnewwindow.png
  12. Close the Console Root window so that only the URL window is visible.
    8-urlwindow.png
  13. Click File > Options
  14. Give the console a title, I have called mine Favourite-o-matic. Under Console Mode, select User mode – limited access, single window. If you want to, you can change the icon to a more user friendly icon. I like the windows Favourite icon from shell32.
    9-usersettings.png10-changeicon.png
  15. Click OK to close the options dialog.
  16. Click File > Save and save the new console to a share where all of your Favourite Managers can access it. Set up the appropriate links on the start menu / desktop and you’re all done.

Using the Console

All you now need to do is let users know how to add favourites. You can do this by double-clicking on Favourites and Links, and typing links into the tool. You can also organise the favourites into folders to make them easier to manage.

8-urlwindow.png

The only caveat is that when you remove a link, it will not take the link from the user’s Favourites folder. This would still have to be deleted manually. Bear this in mind when you go nuts with all of your new favourite links.

Virtual Desktop for Windows XP and Vista

Yes, it’s true!

Windows Vista may actually start making use of the 3D effects enjoyed by other operating systems for so long now.

Most notably, the virtual desktop has been toyed around with before in Windows, but it never seems to be executed well. So it seems fitting that there’s a Vista / XP Virtual Desktop Manager open-source project on codeplex. The current version is 0.5, which is a release candidate.

The desktop manager itself works, but isn’t fantastic. It’s still a little buggy and as such, the live updating doesn’t seem to work exactly as advertised. What is more appealing is that the next version is showing promising signs that it may include an Exposé-like feature for task switching. If this can replace or be added onto the rather lame Flip-3D feauture, then that’s even better.

Whatever next? Fast file access in Vista?

Office 2007 Deployment Computer Startup Scripts

Now that MS Office 2007 is doing the rounds, I suppose it’s time to lookat some of its shortcomings.

It has a few when it comes to deployment. The biggest nuisance being deployment.

You have four options:

  • Install it on a PC manually (not great)
  • Deploy through group policy with no customisations
  • Use a deployment system such as SMS
  • Use a computer startup script

You may as well just say “no” to the first one. Anything more than a handful of PCs and you have a tedious task.

Group Policy has always been my method of choice. Most of my clients have less than 100 PCs, so Group Policy deployment is ideal. But as pointed out in the list, you cannot customise the installation with any defaults.

SMS is out. It’s not worth explaining to clients why it’s a good idea to buy software that makes my life easier. Even though the effort and management might simplify things somewhat.

So we’re stuck with computer startup scripts. Another method I hate – but if you want to control Office Deployments, then this is the way to do it. Thankfully, Aaron Parker has posted some startup scripts to help with this using the MSP method.

If you are using a network with WSUS, then updates become a non-issue, and I think that the only time to need to redeploy is if you decide to change the application packages that you want. At which point, you could check that executables of the programs exist or record your own registry entries that you can check for.

It’s not a great method (I’ve managed to avoid having to use ANY computer startup scripts in 2000-based networks) – but there’s no reason why it shouldn’t work. Especially if you make sure to use the quiet options in the Setup /admin tool.

Office, eh?