Adding Printers will Hang a Vista Logon to a Domain

When you’re setting up a Windows Vista system on your network for the first time, you might find that adding printers becomes an issue because the UAC prompt appears.

Unfortunately, if you do this with a logon script – then the logon will hang until the script timeout expires. Worse still, if you’re using Group Policy Preferences to set up the printer it will cause the logon to hang indefinitely.

If you’re experiencing this problem – then you need to make sure that the Trusted Printer settings are either configured correctly, or disabled so that printer installation behaves as it would in previous versions of Windows such as 2000 and XP.

Firstly, you’ll need to open the Group Policy Management console, and navigate to the OU which contains the user accounts that are likely to add printers and edit the policy.

Open User Settings >Administrative Templates > Control Panel > Printers.

To prevent Vista from ever prompting to install the printer drivers, simply disable the Point and Print Restrictions setting. If you need to control where printers can be installed from then you need to edit the Approved Servers setting instead.

If you’ve used group policy preferences, make sure that you’ve set the Run in logged-on user’s security context option.

Once configured, you should be able to log on with a user account that automatically adds the printer without a hitch.

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).

Praise Be for Regular Expressions

I used a regular expression in VB for the first time ever (I think) today!

The reason is that I cached some generated ASP and realised that when I needed to use it on different pages, the id lookup for certain elements would change. So, no problem (except for the fact that I’m coding in ASP):

<code>Dim regExpObj, file_content, newStr
Set regExptObj = new RegExp
With regExpObj
    .Pattern = "idTag[0-9]" 'Matches the id name that I'm using,
        'regardless of what number the generated code makes it
    .Global = True 'Matches all occurrences, not just the first
End With

newStr = objRegExp.Replace (file_content, "idTag3")

response.write newStr


TrueCrypt Autorun Script for USB

You can easily create an Autorun file on a USB pen drive to mount and dismount the encrypted file systems. This is very useful for carry portable TrueCrypt USB drives.

The only downside is that using TrueCrypt on the move means that you need administrator rights to access the disk.

Once you plug in the USB stick, you should see the typical Windows menu pop up. You can also right-click on the drive icon to mount, dismount and run the truecrypt application.


action=Mount TrueCrypt Volume
open=truecrypt /v /li /q /a /m rm /e</code>
shell\mounttc\command=truecrypt /v /li /q /a /m rm /e</code>
shell\dismounttc\command=truecrypt /di /q</code>
shell\runtc=Run TrueCrypt

WordPress 2.5

I upgraded to WordPress 2.5 today.

It’s great. Installation was a breeze, and the new admin interface is sleek and simple to use. It works much better than the onl one as an added bonus.

I’m not going to go on and on about it, when so many of its neat features are already on the WordPress site.

One thing that I have found increasingly useful of late is an upgrade script that I found on the internet. Whenever a new version of WordPress is released, I run a shell script that lives on my server, and WordPress is automatically upgraded. I suppose I’ll have to post that soon!